/* Member workspace continuation of the editorial theme.
   Explicit foreground/background pairs replace the mixed blue/gold overrides.
   Table widths, column order and permission rules stay with the legacy engine. */
@media screen {
  body.tool-editorial:not(.customer-lead-mode) {
    --navy: #202e30; --navy2: #293d3e; --navy3: #405851;
    --gold: #8b5039; --gold2: #a16045; --gold3: #754831;
    --cream: #f5f2eb; --cream2: #eaece2;
    --bg: #f5f2eb; --sf: #fcfaf6; --sf2: #eef0e8;
    --bd: #d1d5c9; --bd2: #bac2b2; --bdc: #d1d5c9;
    --tx: #202e30; --mu: #5d655f; --hi: #697268;
    --r: 6px; --rl: 8px;
  }

  /* Shared actions: dark primary, pale secondary, red destructive. */
  body.tool-editorial :is(.btn, .fadd, .fdel, .ftab) {
    border-radius: 6px !important; box-shadow: none !important;
    letter-spacing: .01em; line-height: 1.5;
  }
  body.tool-editorial :is(.btn.bnavy, .btn.bgold, .btn.bpri, .gate-btn.primary, .savebtn, .yijing-open-btn),
  body.tool-editorial button[style*="background:var(--navy)"][style*="color:var(--gold)"],
  body.tool-editorial button[style*="background:var(--gold)"][style*="color:var(--navy)"] {
    background: #263c34 !important; color: #fff !important;
    border: 1px solid #263c34 !important;
  }
  body.tool-editorial :is(.btn.bnavy, .btn.bgold, .btn.bpri, .gate-btn.primary, .savebtn, .yijing-open-btn):hover:not(:disabled) {
    background: #395648 !important; border-color: #395648 !important; opacity: 1;
  }
  body.tool-editorial :is(.btn.bout, .fadd, .ftab, .gate-btn.secondary) {
    background: #fcfaf6 !important; color: #34473c !important;
    border: 1px solid #bac2b2 !important;
  }
  body.tool-editorial :is(.btn.bout, .fadd, .ftab):hover:not(:disabled) { background: #e9ede3 !important; border-color: #7f9481 !important; }
  body.tool-editorial :is(.btn.bred, .fdel, #tbl-bulk-del) { background: #fcf7f3 !important; color: #963f35 !important; border: 1px solid #cb9b92 !important; }
  body.tool-editorial :is(.btn.bred, .fdel, #tbl-bulk-del):hover:not(:disabled) { background: #f4e5e0 !important; }
  body.tool-editorial .btn.bgreen { background: #e8eee3 !important; color: #355a3e !important; border-color: #b9cbb1 !important; }
  body.tool-editorial .rdel:hover { color: #963f35; background: #f4e5e0; }
  body.tool-editorial .toast { background: #263c34; color: #fff; border-color: #526e57; border-radius: 6px; }
  body.tool-editorial .mmt-premium-ribbon { background: #e4e9d9; color: #40543f; box-shadow: none; }
  body.tool-editorial .ftab.on { background: #263c34 !important; color: #fff !important; border-color: #263c34 !important; }
  body.tool-editorial .ftab.on:hover:not(:disabled) { background: #395648 !important; color: #fff !important; border-color: #395648 !important; }

  /* The persistent member toolbar and its expanded navigation. */
  body.tool-editorial .topbar { background: #fcfaf6 !important; border-color: #d1d5c9 !important; box-shadow: none !important; padding-block: 10px; }
  body.tool-editorial .tbrand a {
    color: #34473c !important; border-color: #c6cebf !important;
    background: transparent; font-size: 16px !important; letter-spacing: .04em !important;
    border-radius: 6px !important; min-height: 44px;
  }
  body.tool-editorial .topbar :is(.pill, .pill.gpill, #ai-credit-pill) {
    background: #ecefe5 !important; color: #40543f !important;
    border: 1px solid #c5ceba !important; border-radius: 6px !important;
    font-size: 15px; min-height: 42px; box-shadow: none !important; transform: none;
  }
  body.tool-editorial .topbar :is(.pill, .pill.gpill, #ai-credit-pill):hover { background: #e1e7d8 !important; }
  body.tool-editorial .topbar #auth-btn { background: #f3f2e9 !important; color: #34473c !important; border-color: #c6cebf !important; }
  body.tool-editorial #auth-btn > span { color: #34473c !important; font-size: 15px !important; letter-spacing: .02em !important; }
  body.tool-editorial #auth-btn > span:last-child { color: #5d655f !important; }
  body.tool-editorial #auth-btn .auth-name { color: #202e30 !important; font-weight: 650; }
  body.tool-editorial #cloud-sync-status { border-radius: 6px !important; font-size: 14px !important; }
  body.tool-editorial .tbtabs-bar { border-color: #d1d5c9; padding-top: 10px; margin-top: 6px; }
  body.tool-editorial .tbtabs-hint { color: #697268; }
  body.tool-editorial :is(.tbtabs-toggle, .tbtabs-chip) { background: #fcfaf6; color: #34473c; border-color: #bac2b2; border-radius: 6px; }
  body.tool-editorial :is(.tbtabs-toggle, .tbtabs-chip):hover { background: #e9ede3; color: #263c34; border-color: #7f9481; }
  body.tool-editorial .tbtabs-chip.on,
  body.tool-editorial .topbar.tabs-open .tbtabs-toggle { background: #263c34; color: #fff; border-color: #263c34; }
  body.tool-editorial .topbar .tbtabs { background: #fcfaf6; border-color: #c5ceba; box-shadow: 0 12px 24px #202e3014; }
  body.tool-editorial .tbtn { color: #435548 !important; border-radius: 4px; letter-spacing: .02em; }
  body.tool-editorial .tbtn.on { color: #263c34 !important; background: #e5ebdf; border-bottom-color: #526e57 !important; letter-spacing: .02em; }
  body.tool-editorial .tbtn:hover:not(.on) { color: #263c34 !important; background: #edf0e7; }
  body.tool-editorial .tbtn.tool-locked { color: #697268 !important; }
  body.tool-editorial .tbtn.tool-locked::before { color: #8b5039; }
  body.tool-editorial .tbsep { background: #eeeee4 !important; color: #66644c !important; border-color: #d1d2bf !important; }
  body.tool-editorial :is(.syncpanel, .navdrop-menu) { background: #fcfaf6 !important; border-color: #c5ceba !important; }
  body.tool-editorial :is(.synct, .syncstep span) { color: #34473c !important; }
  body.tool-editorial :is(.syncd, .syncstep, .rmode label, .syncclose) { color: #5d655f; }
  body.tool-editorial .navdrop-menu a { color: #34473c; }
  body.tool-editorial .navdrop-menu a:hover { color: #263c34 !important; background: #e9ede3 !important; border-left-color: #526e57 !important; }

  /* Data-entry controls keep their native disabled / checked behaviour. */
  body.tool-editorial:not(.customer-lead-mode) :is(input, select, textarea) { accent-color: #405f48; }
  body.tool-editorial input:is([type="checkbox"], [type="radio"]) {
    width: 18px !important; min-width: 18px !important; height: 18px !important;
    min-height: 0 !important; padding: 0 !important; flex-shrink: 0;
  }
  body.tool-editorial #pane-db :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    border-color: #bac2b2 !important; border-radius: 5px !important;
    color: #202e30; background-color: #fffefb;
  }
  body.tool-editorial #pane-db input::placeholder { color: #737b70; opacity: 1; }
  body.tool-editorial #pane-db .ci { background: transparent; }
  body.tool-editorial #pane-db .ci:focus { background: #fffefb !important; }
  body.tool-editorial #pane-db .fbar { background: #fcfaf6; border-color: #d1d5c9; border-radius: 6px; box-shadow: none; padding: 14px 16px; }
  body.tool-editorial #pane-db > .shdr { justify-content: space-between; text-align: left; margin: 24px 0 !important; gap: 16px; }
  body.tool-editorial #pane-db #dbtitle {
    font-family: var(--editorial-serif) !important; font-size: clamp(25px, 2.5vw, 34px) !important;
    font-weight: 600 !important; line-height: 1.5 !important; color: #202e30; letter-spacing: .01em !important;
  }
  body.tool-editorial #pane-db :is(#import-file-box, #rank-setting-panel, .tbl-filter-panel, .nbox) {
    background: #eef0e8 !important; color: #34473c; border: 1px solid #cbd3c1 !important;
    border-radius: 6px !important; box-shadow: none;
  }
  body.tool-editorial #pane-db #import-file-box { padding: 16px !important; }
  body.tool-editorial #import-file-box > div:last-child { font-size: 15px !important; line-height: 1.85 !important; }
  body.tool-editorial #pane-db :is(#import-file-box, #rank-setting-panel) a { color: #52664d !important; }
  body.tool-editorial #rank-panel-caret { color: #40583f !important; }
  body.tool-editorial #pane-db .tbl-filter-panel { background: #f8f7f1 !important; padding: 16px; gap: 12px; }
  body.tool-editorial .nbox code { background: #e0e6d6; color: #34473c; }
  body.tool-editorial .tbl-col-chip { background: #fcfaf6; color: #34473c; border-color: #c7cebe; border-radius: 5px; }
  body.tool-editorial .tbl-col-chip.off { background: #f0f1ea; }
  body.tool-editorial :is(.tbl-col-move, .tbl-row-drag) { background: #fcfaf6; color: #526a4e; border-color: #c7cebe; }
  body.tool-editorial :is(.tbl-col-move, .tbl-row-drag):hover:not(:disabled) { background: #e5ebdd; border-color: #829776; color: #344b35; }
  body.tool-editorial :is(.tbl-col-grip, .tbl-col-reset) { color: #64745d; }
  body.tool-editorial .tbl-col-reset { border-color: #c7cebe; }
  body.tool-editorial #group-type-bar button { border-radius: 5px !important; }
  body.tool-editorial #group-type-bar button[style*="background:var(--navy)"] { background: #263c34 !important; color: #fff !important; border-color: #263c34 !important; }
  body.tool-editorial #group-type-bar button[style*="background:#fff"] { background: #fcfaf6 !important; color: #34473c !important; border-color: #bac2b2 !important; }

  /* Table geometry and the four energy colours remain meaningful. */
  body.tool-editorial #pane-db .twrap { background: #fcfaf6; border-color: #cbd3c1; border-radius: 6px; box-shadow: none; }
  body.tool-editorial #member-table thead th { background: #293e35; color: #fff; border-color: #5e7260; }
  body.tool-editorial #member-table thead tr.sub th { background: #344b3e; color: #e0e7dc; }
  body.tool-editorial #member-table tbody td { background-color: #fcfaf6; }
  body.tool-editorial #member-table tbody tr:nth-child(even) td { background-color: #f0f2e9; }
  body.tool-editorial #member-table tbody tr:hover td { background-color: #e9efdf !important; }
  body.tool-editorial #member-table tbody td.grp-start { border-left-color: #c5ceba; }
  body.tool-editorial #member-table .th-resizer::after { background: #c6b381; }
  body.tool-editorial #member-table .th-resizer:is(:hover, .active)::after { background: #e3d099; box-shadow: none; }
  body.tool-editorial #pane-ys thead th { background: #293e35 !important; color: #fff !important; border-color: #5e7260 !important; }
  body.tool-editorial:not(.customer-lead-mode) .chip.cg { background: #eeede3; color: #51563f; }
  body.tool-editorial:not(.customer-lead-mode) .chip.cm { background: #e7eee9; color: #395a4d; }
  body.tool-editorial:not(.customer-lead-mode) .chip.cs { background: #f4e8e4; color: #8a4c44; }
  body.tool-editorial:not(.customer-lead-mode) .chip.cy { background: #e8eee3; color: #355a3e; }
}

@media screen and (max-width: 760px) {
  body.tool-editorial .topbar { padding-inline: 12px; gap: 8px; }
  body.tool-editorial .tbrand a { font-size: 14px !important; letter-spacing: .02em !important; }
  body.tool-editorial .topbar :is(.pill, .pill.gpill, #ai-credit-pill) { font-size: 13px !important; }
  body.tool-editorial #auth-btn > span { font-size: 13px !important; }
  body.tool-editorial .tbtabs-bar { padding-inline: 0; gap: 8px; }
  body.tool-editorial #pane-db .fbar { gap: 8px; padding: 12px; }
  body.tool-editorial #pane-db > .shdr { margin-block: 20px !important; }
  body.tool-editorial #pane-db #dbtitle { font-size: 25px !important; }
  body.tool-editorial #pane-db .tbl-filter-panel { padding: 12px; }
  body.tool-editorial #pane-db .twrap::before { color: #5d655f; background: #eef0e8; border-color: #cbd3c1; }
}

/* Share a row whenever the available width and actual labels allow it. */
@media screen and (min-width: 1100px) {
  body.tool-editorial .topbar { column-gap: 8px; row-gap: 8px; }
  body.tool-editorial .topbar .tbtabs-bar {
    order: 0; flex: 0 1 auto; width: auto; max-width: 100%;
    padding: 0; margin: 0; border-top: 0;
  }
  body.tool-editorial .topbar .tbtabs-hint { display: none; }
  body.tool-editorial .topbar .tbtabs-quick { flex: 0 1 auto; }
  body.tool-editorial .topbar > :is(.gpill, #ai-credit-pill) { margin-left: 0 !important; }
}
