:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e1ea;
  --soft: #f3f6fa;
  --paper: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --warn: #b7791f;
  --danger: #991b1b;
  --gain: #b91c1c;
  --loss: #047857;
  --panel: #fbfdff;
  --sidebar: #1f2937;
  --sidebar-2: #111827;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
  --shadow-soft: 0 1px 2px rgba(23, 32, 51, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "notice notice"
    "side main";
  color: var(--ink);
  background: #eef3f8;
  font-family: "Microsoft JhengHei", "Segoe UI", system-ui, sans-serif;
}

body.authLocked {
  display: block;
}

body.authLocked .noticeBoard,
body.authLocked .sidebar,
body.authLocked .main {
  display: none;
}

.loginShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(243, 246, 250, 0.92)),
    #eef3f8;
}

body:not(.authLocked) .loginShell {
  display: none;
}

.loginPanel {
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.loginBrand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.loginBrand h1,
.loginBrand p {
  margin: 0;
}

.loginBrand h1 {
  font-size: 23px;
  margin-top: 3px;
}

.loginBrand p,
.loginHint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.loginForm {
  display: grid;
  gap: 9px;
}

.loginForm label,
.memberForm label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.loginForm button {
  margin-top: 8px;
}

.loginMessage {
  min-height: 22px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

button,
input,
select {
  font: inherit;
}

.noticeBoard {
  grid-area: notice;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 54px;
  padding: 7px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  z-index: 5;
}

.noticeTextBlock {
  min-width: 0;
}

.noticeBoard h1,
.noticeBoard p {
  margin: 0;
}

.noticeBoard h1 {
  font-size: 17px;
  line-height: 1.2;
}

.noticeBoard p {
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.noticeStats {
  display: grid;
  grid-template-columns: repeat(4, 74px);
  gap: 8px;
}

.noticeStats div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 8px;
  background: #f8fafc;
}

.noticeStats strong,
.noticeStats span {
  display: block;
}

.noticeStats strong {
  color: var(--ink);
  font-size: 16px;
}

.noticeStats span {
  color: var(--muted);
  font-size: 11px;
}

.sidebar {
  grid-area: side;
  min-height: 0;
  height: calc(100vh - 54px);
  padding: 16px;
  background: linear-gradient(180deg, #263241 0%, #121826 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  font-weight: 800;
  font-size: 22px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panelHead h3 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p,
.searchBox label,
.topbar p,
.metrics label,
.rowCount {
  color: #9ca3af;
  font-size: 13px;
}

.primary,
button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 36px;
  padding: 0 13px;
  color: var(--ink);
  background: #edf2f7;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.primary {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

button:hover {
  filter: none;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.moduleNav {
  display: grid;
  gap: 12px;
}

.navGroup {
  display: grid;
  gap: 6px;
}

.navGroup > span {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0 4px;
}

.moduleNav button,
.dataTools button {
  justify-content: flex-start;
  text-align: left;
}

.sidebar button {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.07);
  color: #e5edf5;
}

.sidebar .primary,
.sidebar button.primary {
  border-color: rgba(255, 255, 255, 0.18);
  background: #ffffff;
  color: #111827;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.utilityOnly {
  display: none;
}

.dataTools {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.dataTools span {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 800;
}

.userBox {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 7px;
}

.userBox span {
  color: #aab6c5;
  font-size: 11px;
  font-weight: 800;
}

.userBox strong {
  color: #ffffff;
  font-size: 14px;
}

.userBox button {
  width: 100%;
}

.searchBox,
.filter {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 12px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
}

.sidebar input,
.sidebar select {
  border-color: #374151;
  background: #0b1220;
  color: white;
}

.tableList {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.tableList.hidden {
  display: none;
}

.moduleNav {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid #273244;
}

.moduleNav button {
  width: 100%;
  text-align: left;
}

.tableItem {
  text-align: left;
  color: #d1d5db;
  background: transparent;
  border-color: #273244;
  padding: 10px 12px;
  height: auto;
}

.tableItem.active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.18);
  color: white;
}

.tableItem strong,
.tableItem span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tableItem span {
  color: #9ca3af;
  font-size: 12px;
  margin-top: 3px;
}

.main {
  grid-area: main;
  min-width: 0;
  height: calc(100vh - 54px);
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.topbar,
.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  font-size: 21px;
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.metrics.hidden {
  display: none;
}

.metrics div,
.panel,
.message {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics div {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--accent-dark);
  font-size: 26px;
  font-weight: 800;
}

.metrics label {
  color: var(--muted);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panelHead {
  min-height: 46px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.filter {
  width: min(420px, 100%);
}

.filter label {
  color: var(--muted);
  font-size: 13px;
}

.dataView {
  overflow: auto;
  max-height: calc(100vh - 270px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475569;
  z-index: 1;
}

.empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  color: var(--ink);
  font-size: 20px;
}

.message {
  padding: 14px 16px;
  color: var(--accent-dark);
}

.message.error {
  color: var(--danger);
}

.adminLayout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px;
}

.memberForm {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.memberForm h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.checkboxLine {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
}

.checkboxLine input {
  width: auto;
  min-height: auto;
}

.usersView {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.usersTable {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.usersTable th,
.usersTable td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}

.usersTable th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.usersTable tr:last-child td {
  border-bottom: 0;
}

.userActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #ecfdf5;
  color: var(--loss);
}

.statusPill.off {
  background: #f1f5f9;
  color: var(--muted);
}

.hidden {
  display: none;
}

.profileGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px;
}

.dashboardView {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.dashMetrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.dashMetric,
.dashTable {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.dashMetric {
  padding: 16px;
}

.dashMetric strong {
  display: block;
  color: var(--accent-dark);
  font-size: 24px;
}

.dashMetric span {
  color: var(--muted);
  font-size: 13px;
}

.dashTables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashTable h4 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.dashTable .dataView {
  max-height: 360px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab.active {
  color: white;
  background: var(--accent);
}

.logicBar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.logicBar span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.logicBar .marketChip {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.picksView {
  overflow: auto;
  max-height: 560px;
}

.scoreCell {
  font-weight: 800;
  color: var(--accent-dark);
}

.tagText {
  color: var(--warn);
  font-weight: 700;
}

.riskBadge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 3px 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.gateBadge,
.qualityBadge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.gateBadge.profit,
.qualityBadge.profit {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--gain);
}

.gateBadge.warn,
.qualityBadge.warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: var(--warn);
}

.gateBadge.danger,
.qualityBadge.danger {
  border-color: #fca5a5;
  background: #7f1d1d;
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:disabled:hover {
  transform: none;
}

.stockLink {
  color: var(--accent-dark);
  font-weight: 800;
  cursor: pointer;
}

.detailView {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.scoreGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 12px;
}

.scoreBox {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.scoreBox strong {
  display: block;
  color: var(--accent-dark);
  font-size: 24px;
}

.detailCols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.detailItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.detailItem label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stockSearch {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stockSearch input {
  min-width: 280px;
}

.kAnalysisView {
  padding: 16px;
  overflow: auto;
  max-height: 650px;
}

.kHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.kHeader h3 {
  margin: 0 0 4px;
}

.kHeader p {
  margin: 0;
  color: var(--muted);
}

.kChartPanel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.kChartHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.kTabs {
  justify-content: flex-start;
}

.kLineCanvas {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
}

.kGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.kFrame {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.kFrame header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.kFrame h4,
.kNotes h4 {
  margin: 0;
}

.kNotes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.kNotes section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.kNotes ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.buyForm {
  display: grid;
  grid-template-columns: 1fr 140px 120px 1.3fr auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.buyForm label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.workbenchGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 390px);
  min-height: 420px;
  overflow: hidden;
}

.workbenchGrid h4 {
  margin: 0 0 10px;
}

.workbenchGrid > section {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.candidateGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.candidateCard,
.watchCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.candidateCard {
  display: grid;
  gap: 8px;
}

.candidateCard header,
.watchCard header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.candidateCard h5,
.watchCard h5 {
  margin: 0;
  font-size: 16px;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: #ecfdf5;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.entryPill {
  display: inline-flex;
  margin-top: 6px;
}

.riskLine {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 6px 0;
}

.candidateCard .riskLine {
  margin: 0;
}

.riskLine div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fafc;
}

.riskLine label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.riskLine strong {
  font-size: 13px;
}

.exitPlan,
.exitSummary {
  display: grid;
  gap: 6px;
}

.exitPlan {
  grid-template-columns: repeat(3, 1fr);
  margin: 6px 0;
}

.exitPlan div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff7ed;
}

.exitPlan label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.exitPlan strong {
  font-size: 13px;
}

.checkList {
  margin: 0 0 8px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.candidateCard .checkList {
  display: none;
}

.cardActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.watchlistView {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.watchSignal {
  color: var(--warn);
  font-weight: 800;
}

.holdoverBox {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 10px;
  background: #fff7ed;
}

.holdoverBox.danger {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.holdoverBox strong {
  font-size: 13px;
}

.holdoverBox span {
  font-size: 12px;
  font-weight: 800;
}

.holdoverBox small {
  color: var(--muted);
  line-height: 1.45;
}

.holdingSummary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.summaryCard {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px 9px 13px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.summaryCard::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #cbd5e1;
}

.summaryCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summaryCard strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.15;
}

.summaryCard.open strong,
.summaryCard:nth-child(5) strong {
  font-size: 12px;
}

.summaryCard.gain strong,
.gain {
  color: var(--gain);
}

.summaryCard.loss strong,
.loss {
  color: var(--loss);
}

.summaryCard.gain::before {
  background: var(--gain);
}

.summaryCard.loss::before {
  background: var(--loss);
}

.summaryCard.danger {
  border-color: #b91c1c;
  background: #fef2f2;
}

.summaryCard.danger::before {
  background: var(--danger);
}

.summaryCard.open {
  border-color: #f6d48f;
  background: #fffbeb;
}

.summaryCard.open::before {
  background: var(--warn);
}

.buyForm {
  grid-template-columns: minmax(90px, 0.9fr) 110px 90px 80px 80px 80px minmax(130px, 1.1fr) auto;
  gap: 8px;
  padding: 8px 12px;
}

.buyForm input,
.buyForm select,
.buyForm button {
  min-height: 34px;
}

.holdingConsole {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 10px 12px;
  height: calc(100vh - 400px);
  min-height: 300px;
  overflow: hidden;
}

.overviewGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.95fr);
  grid-template-rows: minmax(176px, 1fr) minmax(176px, 1fr);
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 210px);
  min-height: 430px;
}

.overviewBlock {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.overviewBlock.wide {
  grid-row: span 2;
}

.overviewTableView,
.advisorView {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #ffffff;
}

.compactTable,
.advisorTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.compactTable th,
.compactTable td,
.advisorTable th,
.advisorTable td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compactTable th,
.advisorTable th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f8fafc;
}

.compactTable td:first-child,
.advisorTable td:first-child {
  font-weight: 800;
}

.compactTable .stockLink,
.advisorTable .stockLink {
  cursor: pointer;
  color: var(--accent-dark);
}

.advisorForm {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.advisorQuickFields {
  display: grid;
  grid-template-columns: 108px 96px 100px 82px 82px 82px 82px auto;
  gap: 8px;
  align-items: end;
}

.advisorForm div,
.advisorAdvancedGrid div {
  min-width: 0;
}

.advisorForm label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 3px;
}

.advisorForm input,
.advisorForm select,
.advisorForm button {
  width: 100%;
  min-height: 34px;
}

.advisorReasonField {
  min-width: 160px;
}

.advisorAdvanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.advisorAdvanced summary {
  cursor: pointer;
  padding: 8px 10px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.advisorAdvancedGrid {
  display: grid;
  grid-template-columns: 96px 110px 80px minmax(180px, 1fr);
  gap: 8px;
  padding: 0 10px 10px;
}

.advisorConsole {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  padding: 10px 12px;
  height: calc(100vh - 363px);
  min-height: 330px;
  overflow: hidden;
}

.advisorTableSection {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.advisorRow {
  cursor: pointer;
  border-left: 3px solid transparent;
}

.advisorRow:hover,
.advisorRow.active {
  background: #edf7ff;
}

.advisorRow.profit {
  border-left-color: var(--gain);
  background: #fff7ed;
}

.advisorRow.danger {
  border-left-color: var(--danger);
  background: #fff1f2;
}

.advisorTable td:first-child span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.advisorActions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.researchSectionLabel {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 5px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
}

.holdingTableSection,
.decisionPanel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.sectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.sectionHead h4 {
  margin: 0;
  font-size: 15px;
}

.sectionHead span {
  color: var(--muted);
  font-size: 12px;
}

.watchlistView {
  display: block;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  background: #ffffff;
}

.holdingTable {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.holdingTable th,
.holdingTable td {
  border-bottom: 1px solid var(--line);
  padding: 6px 7px;
  text-align: left;
  white-space: nowrap;
}

.holdingTable th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.holdingRow {
  cursor: pointer;
  border-left: 3px solid transparent;
}

.holdingRow:hover,
.holdingRow.active {
  background: #edf7ff;
}

.holdingRow.urgent {
  border-left-color: var(--danger);
  background: #fff1f2;
}

.holdingRow.urgent.active {
  background: #ffe4e6;
}

.holdingRow.profit {
  border-left-color: var(--gain);
  background: #fff7ed;
}

.holdingRow.hold.active,
.holdingRow.risk.active {
  border-left-color: var(--accent);
}

.holdingTable td:first-child span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.holdingTable th:nth-child(1),
.holdingTable td:nth-child(1) {
  width: 82px;
}

.holdingTable th:nth-child(2),
.holdingTable td:nth-child(2) {
  width: 62px;
}

.holdingTable th:nth-child(7),
.holdingTable td:nth-child(7),
.holdingTable th:nth-child(9),
.holdingTable td:nth-child(9) {
  width: 42px;
}

.holdingTable th:nth-child(8),
.holdingTable td:nth-child(8) {
  width: 62px;
}

.holdingTable th:nth-child(10),
.holdingTable td:nth-child(10) {
  width: 76px;
}

.typePill,
.actionPill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 800;
}

.typePill {
  color: #1f2937;
  background: #e5e7eb;
}

.actionPill {
  color: #115e59;
  background: #ccfbf1;
}

.actionPill.urgent {
  color: #991b1b;
  background: #fee2e2;
}

.actionPill.profit {
  color: #9a3412;
  background: #ffedd5;
}

.actionPill.risk {
  color: #047857;
  background: #d1fae5;
}

.dangerText {
  color: #b91c1c;
  font-weight: 800;
}

.holdingDecisionView {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #ffffff;
}

.decisionCard {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.decisionCard header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.decisionCard h5,
.decisionCard h6 {
  margin: 0;
}

.decisionCard h5 {
  font-size: 15px;
}

.decisionCard header span,
.decisionCard p {
  color: var(--muted);
  font-size: 12px;
}

.decisionCard p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.decisionGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.decisionGrid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #f8fafc;
}

.decisionGrid label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.decisionGrid strong {
  font-size: 13px;
}

.decisionCard section {
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfcfe;
}

.decisionCard section:first-of-type {
  border-color: #c7d2fe;
  background: #f8faff;
}

.decisionCard.urgent section:first-of-type {
  border-color: #fecaca;
  background: #fef2f2;
}

.decisionCard.profit section:first-of-type {
  border-color: #fecaca;
  background: #fff7ed;
}

.researchEmpty {
  min-height: 180px;
  padding: 18px;
}

.compact.researchEmpty {
  min-height: 120px;
}

.decisionActions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 28%);
}

.decisionActions button {
  min-height: 34px;
  font-size: 13px;
}

.candidateDock {
  padding: 0 12px 12px;
  opacity: 0.92;
}

.candidateDock .logicBar {
  margin-bottom: 10px;
  max-height: 58px;
  overflow: hidden;
}

.candidateDock .candidateGrid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 300px);
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 4px;
}

.candidateDock .candidateCard {
  min-height: 138px;
  padding: 10px;
  box-shadow: none;
}

.candidateDock .candidateCard h5 {
  font-size: 14px;
}

.candidateDock .candidateCard .samples {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.candidateDock .cardActions button {
  min-height: 32px;
  font-size: 12px;
}

.holdingEmpty {
  height: 100%;
  min-height: 180px;
}

.subHead {
  border-top: 1px solid var(--line);
}

.simView {
  max-height: 260px;
  padding: 14px;
  overflow: auto;
}

.simCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.simCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.simCard[open] {
  box-shadow: var(--shadow);
}

.simCard summary {
  list-style: none;
  cursor: pointer;
}

.simCard summary::-webkit-details-marker {
  display: none;
}

.simCard header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}

.simCard h5 {
  margin: 0;
  font-size: 16px;
}

.simMetrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.simMetrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.simMetrics label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.profit {
  color: #b91c1c;
}

.loss {
  color: #15803d;
}

.simQuick {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.simQuickLine {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.simPnl {
  text-align: right;
  font-size: 20px;
  font-weight: 900;
}

.simHint {
  color: var(--muted);
  font-size: 11px;
  margin-top: 8px;
}

.exitSummary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-top: 8px;
}

.exitSummary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #fff7ed;
  font-size: 12px;
  font-weight: 800;
}

.autoRefreshStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.entryNowView {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  max-height: calc(100vh - 330px);
  min-height: 220px;
  overflow: auto;
  align-content: start;
}

.entryNowCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.entryNowCard.waitCard {
  border-color: #fed7aa;
  background: #fff7ed;
}

.entryNowCard header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.entryNowCard h5 {
  margin: 0;
  font-size: 15px;
}

.quoteOverride {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 8px;
  margin: 6px 0 0;
}

.quoteOverride input {
  min-width: 0;
}

.empty.compact {
  grid-column: 1 / -1;
  min-height: 72px;
}

.groupLayout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  padding: 16px;
}

.groupLayout h4 {
  margin: 0 0 10px;
}

.groupGrid {
  display: grid;
  gap: 12px;
}

.groupCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.groupCard header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.groupCard h5 {
  margin: 0;
  font-size: 16px;
}

.miniStocks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.miniStocks button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.profileCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.profileCard strong {
  display: block;
  margin-bottom: 8px;
}

.bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.samples {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.entryNowCard .samples {
  display: -webkit-box;
  margin: 6px 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "notice"
      "side"
      "main";
  }

  .sidebar {
    height: auto;
    min-height: auto;
  }

  .moduleNav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dataTools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .noticeBoard {
    align-items: stretch;
    flex-direction: column;
  }

  .noticeStats {
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashMetrics,
  .dashTables,
  .scoreGrid,
  .workbenchGrid,
  .overviewGrid,
  .advisorConsole,
  .advisorQuickFields,
  .advisorAdvancedGrid,
  .holdingConsole,
  .buyForm,
  .adminLayout,
  .groupLayout {
    grid-template-columns: 1fr;
  }

  .holdingSummary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .holdingConsole {
    height: auto;
    overflow: visible;
  }

  .overviewGrid,
  .advisorConsole {
    height: auto;
    overflow: visible;
  }

  .holdingTableSection,
  .advisorTableSection,
  .decisionPanel {
    min-height: 320px;
  }

  .workbenchGrid {
    height: auto;
    overflow: visible;
  }

  .candidateGrid,
  .watchlistView {
    max-height: 520px;
  }
}

@media (max-width: 640px) {
  body {
    background: #f8fafc;
  }

  .noticeBoard {
    padding: 9px 12px;
  }

  .noticeBoard p {
    white-space: normal;
  }

  .noticeStats,
  .holdingSummary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .moduleNav,
  .dataTools {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .compactTable,
  .advisorTable,
  .holdingTable,
  .usersTable {
    min-width: 760px;
  }

  .loginPanel {
    padding: 20px;
  }

  .decisionGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
