/* Reference proportions, with Maakali's existing colour palette.
   Loaded last so the earlier visual themes do not alter the shared layout. */
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:400; font-display:swap; src:url('/app/assets/fonts/DMSans-Regular.ttf') format('truetype'); }
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:500; font-display:swap; src:url('/app/assets/fonts/DMSans-Medium.ttf') format('truetype'); }
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:600; font-display:swap; src:url('/app/assets/fonts/DMSans-SemiBold.ttf') format('truetype'); }
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:700 900; font-display:swap; src:url('/app/assets/fonts/DMSans-Bold.ttf') format('truetype'); }

@media screen {
  body { font-family:'DM Sans',sans-serif; font-size:14px; line-height:1.65; }
  .app-shell { grid-template-columns:290px minmax(0,1fr); }
  .app-shell .main { padding:38px 28px 40px; }
  .reference-shell .sidebar,.app-shell>.sidebar { padding:0 12px 20px; gap:0; height:100dvh; overflow-y:auto; }
  .app-shell .sidebar>.brand { display:flex; gap:5px; min-height:62px; padding:12px 10px; margin:0 0 7px; border:0; letter-spacing:0; }
  .app-shell .sidebar .mark { width:30px; height:30px; border-radius:50%; border:0; box-shadow:none; flex:none; }
  .app-shell .sidebar .brand-name { font-size:13px; font-weight:400; letter-spacing:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .app-shell .sidebar .brand-suffix { color:inherit; font-weight:400; }
  .app-shell .sidebar .side-label { display:none; }
  .sidebar-header-toggle { margin-left:auto; flex:none; border:0; padding:0 4px; background:none; color:#d6bd7d; font-size:24px; line-height:1; cursor:pointer; }
  .app-shell .sidebar .nav-list { gap:7px; }
  .app-shell .sidebar .nav-item { min-height:45px; padding:10px 13px; gap:12px; font-size:14px; font-weight:700; line-height:1.5; border-radius:4px; box-shadow:none; }
  .app-shell .sidebar .nav-icon { width:21px; height:24px; font-size:23px; align-items:center; justify-content:center; flex:none; font-weight:400; }
  .app-shell .sidebar .nav-icon svg { display:block; width:23px; height:23px; flex:none; }
  .app-shell .sidebar .nav-children .nav-item { min-height:36px; padding:7px 11px; font-size:13px; }
  .app-shell .sidebar .sidebar-bottom { margin:7px 0 0; min-height:0; border:0; padding:0; }
  .app-shell .sidebar .signout { width:100%; margin:0; color:#edf4ee; }
  .reference-shell:not(.agent-shell) .main>.topbar { display:flex; position:fixed; top:0; left:290px; right:0; z-index:20; height:29px; min-height:29px; margin:0; padding:0; border:0; border-radius:0; box-shadow:none; background:var(--mk-pine); }
  .reference-shell:not(.agent-shell) .main>.topbar>* { display:none; }
  .reference-shell .page-head { display:none; }
  .app-shell:not(.reference-shell) .topbar { padding:8px 12px; margin-bottom:16px; border-radius:4px; box-shadow:none; }
  .app-shell:not(.reference-shell) .page-head h1 { font-size:24px; letter-spacing:0; }
  .reference-shell .ref-market-list,.agent-shell .ref-market-list { display:grid; grid-template-columns:minmax(0,1fr); gap:15px; }
  .reference-shell .ref-market-card,.agent-shell .ref-market-card { border:0; border-radius:4px; padding:18px 24px 22px; box-shadow:0 1px 3px #183f3610; }
  .reference-shell .ref-market-title { display:block; padding-bottom:7px; font-size:16px; line-height:1.6; font-weight:700; }
  .reference-shell .ref-market-title span { display:inline; font-size:14px; margin-left:5px; font-weight:700; }
  .reference-shell .ref-market-result { padding:8px 0 10px; gap:10px; margin:0; border-top:0; }
  .reference-shell .ref-market-result strong { font-size:14px; line-height:1.4; font-weight:700; letter-spacing:0; }
  .reference-shell .ref-market-result .is-closed,.reference-shell .ref-market-result .is-running { font-size:11px; }
  .reference-shell .ref-market-actions { padding-top:11px; gap:4px; }
  .app-shell .btn,.app-shell .ref-btn,.app-shell .ref-purple { min-height:36px; border-radius:4px; padding:7px 18px; font-size:13px; font-weight:700; line-height:20px; box-shadow:none; transition:background .15s ease; }
  .app-shell .ref-market-actions .btn { min-height:30px; padding:5px 12px; font-size:12px; line-height:20px; }
  .app-shell .btn:hover { transform:none; box-shadow:none; }
  .app-shell .ref-panel,.app-shell .card { padding:24px; margin-bottom:15px; border:0; border-radius:4px; box-shadow:0 1px 3px #183f3608; }
  .app-shell .ref-panel h2,.app-shell .card h2 { margin:0 0 14px; font-size:20px; line-height:1.2; letter-spacing:0; font-weight:700; }
  .app-shell .ref-panel h3 { font-size:18px; line-height:1.3; }
  .reference-shell .ref-panel-head { display:flex; flex-direction:row; flex-wrap:nowrap; align-items:center; gap:12px; padding:0 0 10px; margin-bottom:8px; }
  .reference-shell .ref-panel-head h2 { margin:0; }
  .reference-shell .ref-panel-actions { width:auto; gap:5px; flex-wrap:wrap; }
  .reference-shell .field { margin-bottom:10px; min-width:0; }
  .reference-shell .field label { font-size:13px; font-weight:500; margin-bottom:7px; }
  .app-shell .field input,.app-shell .field select,.app-shell .field textarea { min-width:0; width:100%; min-height:36px; border-radius:4px; padding:7px 16px; font-size:13px; line-height:20px; }
  .app-shell .field input[type=checkbox],.app-shell .field input[type=radio] { min-height:0; width:15px; height:15px; padding:0; }
  .reference-shell .table-wrap { border:0; border-radius:0; max-width:100%; }
  .reference-shell .ref-table,.reference-shell .table { width:100%; min-width:0; font-size:14px; line-height:1.65; }
  .reference-shell .ref-table th,.reference-shell .ref-table td,.reference-shell .table th,.reference-shell .table td { padding:5px; vertical-align:middle; border-radius:0; letter-spacing:0; }
  .reference-shell .ref-table th,.reference-shell .table th { text-transform:none; font-size:14px; line-height:1.2; font-weight:700; }
  .reference-shell .ref-table td .btn,.reference-shell .table td .btn { min-height:24px; padding:3px 9px; font-size:11px; line-height:18px; border-radius:3px; margin:0; }
  .reference-shell .form-actions { gap:5px; margin-top:12px; flex-wrap:wrap; }
  .reference-shell .ref-filter-grid { gap:10px 28px; padding-bottom:18px; margin-bottom:8px; }
  .reference-shell .ref-list-search { gap:12px; margin:0 0 12px; }
  .reference-shell .ref-list-search .field { min-width:0; max-width:none; }
  .reference-shell .ref-list-actions { gap:14px; min-width:0; }
  .reference-shell .ref-list-actions input { min-width:0; }
  .reference-shell .ref-list-actions .field { margin:0; }
  .reference-shell .ref-check { border:0; padding:0; background:transparent; border-radius:0; font-size:13px; }
  .reference-shell .ref-check input { width:15px; height:15px; min-height:0; margin:0; }
  .reference-shell .route-backbar { min-height:30px; padding:0; margin:0 0 10px; background:none; border:0; font-size:12px; }
  .reference-shell .route-backbar>span { display:none; }
  .reference-shell .route-back-button { min-height:28px; padding:3px 10px; font-size:12px; border-radius:3px; box-shadow:none; }

  /* Device List uses the reference table columns, with details expanded in place. */
  .agent-directory-filter { display:grid; grid-template-columns:minmax(140px,1fr) minmax(180px,1.4fr) minmax(80px,.65fr); gap:10px 18px; align-items:end; padding-bottom:8px; margin-bottom:0; border-bottom:1px solid var(--mk-line); }
  .directory-search-submit,.agent-directory-item[hidden],.agent-directory-empty[hidden] { display:none!important; }
  .agent-directory-filter>.field:first-child { grid-column:1; grid-row:1; }
  .agent-directory-filter>.field:first-child label { display:block; }
  .agent-directory-filter>h2 { grid-column:1; grid-row:2; margin:0!important; font-size:24px!important; align-self:center; }
  .agent-directory-filter>.field:nth-of-type(2) { grid-column:2; grid-row:2; }
  .agent-directory-filter>.field:nth-of-type(2) label { display:none; }
  .agent-directory-filter>.btn { grid-row:2; }
  .agent-directory-filter>.field { margin:0; }
  .agent-directory-list { display:block; }
  .agent-directory-head,.agent-directory-item>summary { display:grid; grid-template-columns:22px minmax(100px,1fr) minmax(100px,1fr) minmax(70px,.65fr) 74px minmax(230px,1.4fr); gap:5px; align-items:center; padding:5px; min-height:34px; font-size:14px; line-height:1.6; }
  .agent-directory-head { border-bottom:1px solid #aab8af; font-weight:700; }
  .agent-directory-item { border:0; border-radius:0; border-bottom:1px solid var(--mk-line); background:transparent; }
  .agent-directory-item:nth-child(odd) { background:#f6f7f1; }
  .agent-directory-item>summary { list-style:none; }
  .agent-directory-item>summary::-webkit-details-marker { display:none; }
  .agent-directory-item[open]>summary { background:transparent; }
  .agent-directory-name strong,.agent-directory-points strong { display:block; font-weight:400; white-space:normal; overflow:visible; text-overflow:clip; }
  .agent-directory-mobile,.agent-directory-points { white-space:nowrap; font-variant-numeric:tabular-nums; }
  .agent-directory-expand { width:18px; height:18px; background:#8d9691; border:2px solid #fff; box-shadow:0 0 3px #394f4266; color:white; font-size:16px; line-height:1; border-radius:50%; }
  .agent-directory-status { justify-self:start; padding:2px 5px; border-radius:2px; font-size:11px; line-height:1.3; }
  .agent-directory-summary-actions { display:flex; flex-wrap:wrap; gap:4px; }
  .agent-directory-summary-actions .btn,.agent-directory-actions .btn { min-height:24px; padding:3px 7px; font-size:11px; line-height:18px; border-radius:3px; }
  .agent-directory-details { gap:10px 18px; padding:12px 26px; font-size:13px; }
  .agent-directory-actions { justify-content:flex-start; padding-top:9px; }

  /* Profile and price settings have labels at the left and controls at the right. */
  .agent-profile-form { display:block; }
  .reference-shell .agent-profile-form>.field,.reference-shell .ref-rate-row>.field { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:28px; padding:0; margin:0 0 10px; border:0; }
  .reference-shell .agent-profile-form>.field>label,.reference-shell .ref-rate-row>.field>label { margin:0; font-weight:500; }
  .agent-profile-form>.ref-agent-setting-grid { display:block; margin:0; }
  .reference-shell .agent-profile-form .ref-check { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); justify-content:initial; align-items:center; gap:28px; min-height:32px; margin:0 0 10px; padding:0; font-weight:500; line-height:1.65; }
  .reference-shell .agent-profile-form .ref-check input { width:15px; height:15px; justify-self:start; }
  .agent-market-assignments { display:block; border:0; padding:0; margin:0; min-width:0; }
  .agent-profile-form>.form-actions { justify-content:flex-start; }
  .ref-rate-panel>.ref-panel-head h2 { font-size:20px; }
  .reference-shell .ref-rate-select { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:6px; margin:0 0 14px; }
  .reference-shell .ref-rate-select>.field { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:28px; align-items:center; margin:0; }
  .reference-shell .ref-rate-select label { display:block; margin:0; }
  .reference-shell .ref-rate-row { border:0; padding:0; margin:0 0 10px; }
  .reference-shell .ref-rate-row:nth-child(4),.reference-shell .ref-rate-row:nth-child(8) { margin-bottom:24px; }
  .reference-shell .ref-rate-row>.field { margin:0; }
  .reference-shell .ref-rate-panel form { padding-bottom:0; }
  .ref-rate-panel .ref-check { margin-top:16px; line-height:1.5; }

  .reference-shell .ref-points-banner { padding:17px 20px; border-radius:4px; font-size:14px; line-height:1.4; }
  .reference-shell .ref-points-banner strong { display:block; font-size:18px; line-height:1.4; }
  .reference-shell .ref-dark-panel,.reference-shell .agent-hisab-final { padding:20px; border-radius:4px; border:0; margin-bottom:20px; }
  .reference-shell .ref-dark-panel>.table-wrap { display:block; padding:0; border:0; }
  .reference-shell .ref-hisab-head,.agent-report-card form { display:grid; grid-template-columns:minmax(0,1fr) 170px auto; align-items:center; gap:10px; margin-bottom:18px; }
  .reference-shell .ref-hisab-head h2,.reference-shell .agent-report-card h2 { margin:0!important; font-size:20px; }
  .reference-shell .ref-hisab-head .field,.reference-shell .agent-report-card .field { width:auto; max-width:none; margin:0; }
  .reference-shell .ref-hisab-head label,.reference-shell .agent-report-card .field label { display:none; }
  .reference-shell .agent-hisab-market .ref-table,.reference-shell .agent-report-card .ref-table { table-layout:fixed; }
  .reference-shell .agent-hisab-market .ref-table td:nth-child(4),.reference-shell .agent-report-card .ref-table td:nth-child(4) { background:#31d6b0; color:#0b2830!important; }
  .reference-shell .agent-report-card .ref-table td { font-weight:400; color:#f4f7f6; }
  .reference-shell .agent-final-hisab h3,.reference-shell .agent-hisab-final h2 { font-size:20px; margin-bottom:14px; }
  .reference-shell .agent-final-hisab>div,.reference-shell .agent-hisab-final dl>div { padding:10px 4px; line-height:1.5; font-size:14px; border-color:#ffffff40; }
  .reference-shell .agent-final-hisab>div strong,.reference-shell .agent-hisab-final dd { font-weight:400; }
  .reference-shell .agent-hisab-market>.ref-panel-head { margin-bottom:14px; }

  .reference-shell .ref-win-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 28px; align-items:end; }
  .reference-shell .ref-win-form>.field { grid-column:1/-1; margin:0; }
  .reference-shell .ref-win-form>.field:nth-child(1),.reference-shell .ref-win-form>.field:nth-child(2) { grid-column:auto; }
  .reference-shell .ref-win-form>.field:has([name=agent_id]) { grid-row:2; }
  .reference-shell .ref-win-form>.field:has([name=slot]) { grid-row:3; }
  .reference-shell .ref-win-form>.field:has([name=receipt_no]) { grid-row:4; }
  .reference-shell .ref-win-form>.ref-win-actions { display:grid; grid-template-columns:1fr 1fr; grid-column:1/-1; gap:4px; padding:0; }
  .reference-shell .ref-win-form>.ref-win-actions .btn { width:100%; min-height:42px; }
  .reference-shell .agent-win>h2 { font-size:28px; border-bottom:1px solid var(--mk-line); padding-bottom:8px; margin-bottom:8px; }
  .reference-shell .ref-win-section { margin-top:25px; }
  .reference-shell .ref-win-section>h2 { margin:0; padding:8px; font-size:28px; line-height:1.3; }
  .reference-shell .ref-win-section>.ref-win-actions { display:flex; justify-content:space-around; gap:12px; padding:9px 12px; }
  .reference-shell .ref-win-section>.ref-win-actions .btn { min-height:30px; padding:5px 12px; font-size:12px; }
  .reference-shell .ref-win-section .table-wrap { margin-top:16px; }
  .reference-shell .ref-win-section .ref-table { table-layout:auto; }
  .reference-shell .ref-win-section .ref-table th:first-child { width:16%; }
  .reference-shell .ref-win-section .ref-table th:nth-child(2) { width:44%; }
  .reference-shell .ref-win-section .ref-table th { white-space:normal; }

  .reference-shell .board-overview { padding:16px 24px; }
  .reference-shell .board-overview h2 { font-size:20px; }
  .reference-shell .board-overview-summary { margin:8px 0; font-size:13px; }
  .reference-shell .board-overview-filter { max-width:360px; gap:8px; }
  .reference-shell .board-overview-help { font-size:12px; }
  .reference-shell .market-board-section { padding:0; }
  .reference-shell .market-board-heading { padding:8px 12px; border-radius:0; }
  .reference-shell .market-board-heading h3 { font-size:18px; max-width:none; }
  .reference-shell .market-board-tools .btn { min-height:28px; font-size:11px; padding:4px 8px; }
  .reference-shell .market-board-tile { min-height:54px; gap:3px; border-radius:0; }
  .reference-shell .market-board-ank { border-radius:0; font-size:14px; }
  .reference-shell .market-board-footer { padding:12px 16px; }
  .reference-shell .village-pagination { padding:12px 0 0; }
  .reference-shell .village-pagination .btn { min-height:28px; padding:4px 12px; font-size:13px; }
  .reference-shell .village-row-actions { display:flex; flex-wrap:nowrap; gap:4px; }

  .agent-shell.reference-shell .main { padding:0 28px 40px; }
  .agent-shell.reference-shell .topbar { display:block; position:sticky; top:0; z-index:20; min-height:44px; margin:0 -28px 15px; padding:7px 28px; border:0; border-radius:0; box-shadow:none; }
  .agent-shell .agent-top-strip { display:grid; grid-template-columns:minmax(0,1fr) auto auto; min-height:30px; gap:22px; align-items:center; font-size:13px; }
  .agent-shell .agent-menu-button { display:none; }
  .agent-shell .agent-top-strip .ref-point-badge { border-radius:3px; min-width:105px; padding:2px 12px; font-size:12px; text-align:center; }
  .agent-shell .agent-sell-workspace { max-width:none; border:0; border-radius:4px; box-shadow:none; min-height:calc(100dvh - 120px); }
  .agent-shell .agent-sell-heading { padding:8px 12px; gap:10px; flex-wrap:nowrap; }
  .agent-shell .agent-sell-heading h2 { font-size:18px; }
  .agent-shell .agent-sell-heading>div { flex-wrap:nowrap; gap:5px; }
  .agent-shell .agent-sell-heading input { width:100px; min-height:36px; border-radius:3px; font-size:13px; }
  .agent-shell .agent-entry-panel { padding:10px 12px; border-bottom:1px solid var(--mk-line); }
  .agent-shell .agent-game-selects { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:10px; }
  .agent-shell .agent-game-selects select { grid-column:auto; }
  .agent-shell .agent-entry-inputs { grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,1fr) minmax(80px,.7fr); gap:10px; }
  .agent-shell .agent-entry-inputs>.btn { grid-column:4; }
  .agent-shell .agent-game-selects select,.agent-shell .agent-entry-inputs select,.agent-shell .agent-entry-inputs input { min-height:36px; padding:7px 10px; font-size:13px; border-radius:4px; }
  .agent-shell .agent-entry-panel .btn { min-height:36px; border-radius:4px; padding:7px 14px; font-size:13px; }
  .agent-shell .agent-entry-inputs [type=submit] { margin-top:-3px; }
  .agent-shell .agent-entry-inputs .agent-number-field { grid-column:2; }
  .agent-shell .agent-entry-actions { margin-bottom:12px; }
  .agent-shell .agent-draft-panel { padding:12px 12px 24px; }
  .agent-shell .agent-countdown { font-size:14px; }
  .agent-shell .agent-sell-footer { max-width:none; border-radius:0; padding:7px; gap:5px; box-shadow:none; }
  .agent-shell .agent-sell-footer .btn { min-height:36px; border-radius:4px; font-size:13px; padding:7px; }
  .workflow-dialog { border-radius:5px; padding:20px; }
  .notice { border-radius:4px; font-size:12px; padding:10px 12px; }

  .reference-login { display:flex; align-items:center; justify-content:center; min-height:100dvh; padding:28px 16px; }
  .reference-login .login-panel { display:block; flex:0 1 480px; padding:0; background:transparent; }
  .reference-login .login-card { width:100%; max-width:480px; margin:0; padding:40px; border:0; border-radius:4px; box-shadow:0 1px 4px #183f3608; background:var(--mk-surface); }
  .reference-login .mini-brand { display:flex; justify-content:center; gap:14px; margin:0 0 30px; letter-spacing:-.04em; }
  .reference-login .mark { width:64px; height:64px; border-radius:6px; }
  .reference-login .brand-name { font-size:40px; font-weight:700; }
  .reference-login .field { margin:0 0 10px; }
  .reference-login .field label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .reference-login .field input { min-height:42px; padding:10px 16px; border-radius:4px; font-size:14px; }
  .reference-login .btn { width:100%; min-height:44px; margin:0; padding:10px; border-radius:4px; font-size:14px; }
  .reference-login .cover-login-return { margin-top:16px; }
}

@media screen and (min-width:1001px) {
  .app-shell.sidebar-collapsed { grid-template-columns:64px minmax(0,1fr); }
  .app-shell.sidebar-collapsed .sidebar { padding-left:7px; padding-right:7px; }
  .app-shell.sidebar-collapsed .sidebar>.brand { justify-content:center; padding:12px 0; }
  .app-shell.sidebar-collapsed .sidebar .brand-name,.app-shell.sidebar-collapsed .sidebar .mark { display:none; }
  .app-shell.sidebar-collapsed .sidebar-header-toggle { margin:0; }
  .app-shell.sidebar-collapsed .sidebar .nav-item { font-size:0; gap:0; justify-content:center; }
  .app-shell.sidebar-collapsed .sidebar .nav-icon { font-size:23px; }
  .app-shell.sidebar-collapsed .sidebar .nav-children { margin:0; padding:0; border:0; }
  .app-shell.sidebar-collapsed .sidebar .nav-children .nav-item { font-size:10px; }
  .app-shell.sidebar-collapsed .sidebar .nav-chevron { display:none; }
  .reference-shell.sidebar-collapsed:not(.agent-shell) .main>.topbar { left:64px; }
}

@media screen and (max-width:1000px) {
  .app-shell,.reference-shell,.app-shell.sidebar-collapsed { display:block; }
  .app-shell>.sidebar,.reference-shell .sidebar,.agent-shell .sidebar { position:fixed; top:0; left:0; width:min(290px,85vw); height:100dvh; min-height:0; z-index:80; padding:0 12px 20px; transform:translateX(-100%); transition:transform .16s ease; }
  .app-shell>.sidebar.open { display:flex; transform:translateX(0); }
  .app-shell:has(.sidebar.open) .agent-sidebar-shade { display:block; position:fixed; inset:0; width:100%; height:100dvh; z-index:70; border:0; background:#102b2666; }
  .app-shell .main,.reference-shell .main,.agent-shell.reference-shell .main { padding:0 16px 28px; }
  .reference-shell:not(.agent-shell) .main>.topbar,.app-shell:not(.reference-shell) .main>.topbar { display:flex; position:sticky; top:0; left:auto; right:auto; height:auto; min-height:40px; z-index:50; margin:0 -16px 8px; padding:2px 16px; border:0; border-radius:0; background:var(--mk-pine); box-shadow:none; gap:8px; }
  .reference-shell:not(.agent-shell) .main>.topbar>.ref-mobile-menu { display:block; position:static; width:32px; height:36px; flex:0 0 32px; margin:0; padding:0; background:none; border:0; border-radius:0; color:#d6bd7d; font-size:26px; }
  .reference-shell:not(.agent-shell) .main>.topbar>.breadcrumbs { display:none; }
  .reference-shell:not(.agent-shell) .main>.topbar>.top-actions { display:none; }
  .app-shell .sidebar .sidebar-header-toggle { font-size:0; }
  .app-shell .sidebar .sidebar-header-toggle::after { content:'←'; font-size:24px; }
  .app-shell:not(.reference-shell)>.main>.ref-mobile-menu { display:block; position:fixed; top:4px; left:12px; width:32px; height:32px; z-index:60; padding:0; border:0; border-radius:0; color:#d6bd7d; background:none; font-size:26px; }
  .app-shell:not(.reference-shell)>.main>.topbar { padding-left:52px; }
  .app-shell .sidebar .sidebar-bottom { display:block; }
  .reference-shell .ref-market-card,.agent-shell .ref-market-card { padding:16px; }
  .reference-shell .ref-market-title { font-size:15px; }
  .reference-shell .ref-market-title span { display:inline; font-size:13px; white-space:normal; margin-left:4px; }
  .reference-shell .ref-panel,.reference-shell .card { padding:16px; border-radius:4px; }
  .reference-shell .ref-panel h2 { font-size:20px; }
  .reference-shell .agent-directory-head,.reference-shell .agent-directory-item>summary { grid-template-columns:18px minmax(0,1fr) 92px 64px 56px; gap:3px; padding:6px 3px; font-size:12px; min-height:35px; }
  .agent-directory-item>summary .agent-directory-status { display:inline; font-size:10px; }
  .agent-directory-item>summary .agent-directory-points { display:block; }
  .agent-directory-summary-actions,.agent-directory-action-heading { display:none; }
  .agent-directory-details { grid-template-columns:repeat(2,minmax(0,1fr)); padding:10px; }
  .agent-directory-details .agent-directory-actions { display:flex; gap:4px; }
  .agent-directory-details .agent-directory-actions .btn { flex:0 1 auto; min-height:30px; padding:4px 7px; font-size:11px; }
  .agent-directory-filter { grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; gap:8px; }
  .agent-directory-filter>.field:first-child { grid-column:1/3; }
  .agent-directory-filter>h2 { grid-column:1; font-size:18px!important; }
  .agent-directory-filter>.field:nth-of-type(2) { grid-column:2; }
  .agent-directory-filter>.directory-search-submit { grid-row:3; grid-column:2; min-height:28px; padding:3px 10px; justify-self:end; }
  .agent-directory-filter>.btn[data-action=agent-add] { grid-column:3; padding:7px 12px; }
  .reference-shell .village-list-panel .ref-panel-head { display:grid; grid-template-columns:minmax(70px,.8fr) minmax(0,1.8fr); align-items:center; gap:8px; }
  .reference-shell .village-list-panel .ref-panel-head h2 { font-size:18px; }
  .reference-shell .village-list-panel .ref-list-actions { gap:6px; }
  .reference-shell .village-list-panel .ref-list-actions form { flex:1; min-width:0; }
  .reference-shell .village-list-panel .ref-list-actions .btn { padding:7px 12px; }
  .reference-shell .village-list-panel .ref-table { font-size:12px; }
  .reference-shell .village-list-panel .ref-table th,.reference-shell .village-list-panel .ref-table td { font-size:12px; padding:7px 3px; }
  .reference-shell .village-list-panel .ref-table th:nth-child(1) { width:29%; }
  .reference-shell .village-list-panel .ref-table th:nth-child(2) { width:28%; }
  .reference-shell .village-list-panel .ref-table th:nth-child(3) { width:43%; }
  .reference-shell .village-row-actions .btn { min-height:26px; padding:3px 5px; font-size:10px; }
  .reference-shell .ref-rate-panel { padding:16px; }
  .reference-shell .agent-profile-form>.field,.reference-shell .ref-rate-row>.field,.reference-shell .agent-profile-form .ref-check { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; }
  .reference-shell .ref-rate-select { grid-template-columns:minmax(0,1fr) auto; gap:6px; }
  .reference-shell .ref-rate-select>.field { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; }
  .reference-shell .ref-rate-select>.btn { min-height:36px; padding:7px 9px; }
  .reference-shell .ref-hisab-head,.reference-shell .agent-report-card form { grid-template-columns:minmax(0,1fr) 128px auto; gap:5px; margin-bottom:18px; }
  .reference-shell .ref-hisab-head h2,.reference-shell .agent-report-card h2 { grid-column:auto; font-size:18px; }
  .reference-shell .ref-hisab-head .field,.reference-shell .agent-report-card .field { min-width:0; }
  .reference-shell .ref-hisab-head .btn,.reference-shell .agent-report-card form .btn { padding:7px 10px; align-self:center; }
  .reference-shell .agent-hisab-market .ref-table,.reference-shell .agent-report-card .ref-table,.reference-shell.view-village-hisab .ref-table { table-layout:fixed; min-width:0; width:100%; font-size:11px; }
  .reference-shell .agent-hisab-market .ref-table th,.reference-shell .agent-hisab-market .ref-table td,.reference-shell .agent-report-card .ref-table th,.reference-shell .agent-report-card .ref-table td,.reference-shell.view-village-hisab .ref-table th,.reference-shell.view-village-hisab .ref-table td { padding:7px 3px; font-size:11px; letter-spacing:0; }
  .reference-shell .agent-hisab-market .ref-table th:not(:first-child),.reference-shell .agent-report-card .ref-table th:not(:first-child),.reference-shell.view-village-hisab .ref-table th:not(:first-child) { white-space:normal; }
  .reference-shell .agent-hisab-market .ref-table td:not(:first-child),.reference-shell .agent-report-card .ref-table td:not(:first-child),.reference-shell.view-village-hisab .ref-table td:not(:first-child) { white-space:nowrap; font-variant-numeric:tabular-nums; }
  .reference-shell .ref-dark-panel { padding:16px; }
  .reference-shell .agent-hisab-final dl>div,.reference-shell .agent-final-hisab>div { font-size:14px; }
  .reference-shell .agent-win>h2 { font-size:24px; }
  .reference-shell .ref-win-form { gap:10px; }
  .reference-shell .ref-win-form>.ref-win-actions .btn { min-height:40px; }
  .reference-shell .ref-win-section>h2 { font-size:25px; }
  .reference-shell .ref-win-section .ref-table { font-size:12px; }
  .reference-shell .ref-win-section .ref-table th { font-size:12px; }
  .reference-shell .ref-win-section .ref-table th:first-child { width:13%; }
  .reference-shell .ref-win-section .ref-table th:nth-child(2) { width:42%; }
  .reference-shell .ref-win-section .ref-table th:nth-child(4) { width:17%; }
  .reference-shell .ref-win-section .ref-table th:nth-child(5) { width:12%; }
  .reference-shell .ref-win-section .ref-table td { padding:7px 3px; }
  .reference-shell .ref-win-section .ref-table td .btn { padding:3px 5px; min-height:26px; font-size:10px; }
  .reference-shell .ref-win-section .ref-table .small,.reference-shell .ref-win-section .ref-table .muted { font-size:11px; }
  .reference-shell .board-overview-heading h2 { font-size:18px; }
  .reference-shell .board-overview-heading .btn { padding:6px 9px; min-height:32px; font-size:11px; }
  .reference-shell .market-board-heading h3 { max-width:45%; font-size:15px; }
  .reference-shell .market-board-tools { gap:3px; }
  .reference-shell .market-board-tools .btn { padding:4px 6px; font-size:10px; }
  .reference-shell .agent-history-filter { gap:10px; }
  .reference-shell .agent-history .ref-table th,.reference-shell .agent-history .ref-table td { padding:7px 5px; font-size:13px; }
  .reference-shell .ref-pagination { padding:10px 2px; }
  .agent-shell.reference-shell .topbar { margin:0 -16px 8px; padding:4px 12px; min-height:42px; border-radius:0; }
  .agent-shell .agent-top-strip { grid-template-columns:30px minmax(0,1fr) auto auto; gap:8px; min-height:34px; font-size:12px; }
  .agent-shell .agent-menu-button { display:grid; place-items:center; width:30px; height:34px; padding:0; border:0; background:none; border-radius:0; color:#d6bd7d; font-size:26px; }
  .agent-shell .agent-top-strip .ref-point-badge { min-width:85px; padding:1px 7px; font-size:11px; }
  .agent-shell .agent-sell-heading { padding:8px; gap:6px; flex-wrap:nowrap; }
  .agent-shell .agent-sell-heading h2 { min-width:0; font-size:16px; line-height:1.3; }
  .agent-shell .agent-sell-heading input { width:76px; min-height:32px; padding:5px; font-size:11px; }
  .agent-shell .agent-sell-heading .btn { min-height:32px; padding:5px 7px; font-size:11px; }
  .agent-shell .agent-entry-panel { padding:10px 8px; }
  .agent-shell .agent-game-selects { grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; }
  .agent-shell .agent-entry-inputs { grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,1fr) minmax(65px,.8fr); gap:5px; }
  .agent-shell .agent-game-selects select,.agent-shell .agent-entry-inputs select { font-size:11px; min-height:36px; padding:5px; }
  .agent-shell .agent-entry-inputs input { padding:6px; min-height:36px; font-size:16px; }
  .agent-shell .agent-entry-panel .btn { min-height:34px; padding:5px 8px; font-size:12px; }
  .agent-shell .agent-entry-hint { font-size:11px; }
  .agent-shell .agent-draft-panel { padding:10px 8px 24px; }
  .agent-shell .agent-entry-table { font-size:12px; }
  .agent-shell .agent-entry-table th,.agent-shell .agent-entry-table td { padding:7px 4px; }
  .agent-shell .agent-sell-footer { left:16px; right:16px; padding:6px; gap:5px; }
  .agent-shell .agent-sell-footer .btn { min-height:34px; padding:6px; font-size:12px; }
  .agent-shell .agent-separator-button { flex-basis:27px; font-size:20px; }
  .reference-login .login-card { padding:32px 24px; }
}

@media screen and (max-width:360px) {
  .app-shell .main,.reference-shell .main,.agent-shell.reference-shell .main { padding-left:10px; padding-right:10px; }
  .reference-shell:not(.agent-shell) .main>.topbar,.agent-shell.reference-shell .topbar { margin-left:-10px; margin-right:-10px; }
  .reference-shell .ref-panel,.reference-shell .card { padding:12px; }
  .reference-shell .agent-directory-head,.reference-shell .agent-directory-item>summary { grid-template-columns:16px minmax(0,1fr) 80px 53px 49px; gap:2px; font-size:11px; }
  .agent-directory-item>summary .agent-directory-status { font-size:9px; }
  .reference-shell .agent-profile-form>.field,.reference-shell .ref-rate-row>.field,.reference-shell .agent-profile-form .ref-check { gap:10px; }
  .reference-shell .agent-profile-form .field input,.reference-shell .agent-profile-form .field select { padding-left:8px; padding-right:8px; }
  .agent-shell .agent-sell-footer { left:10px; right:10px; }
  .reference-shell .ref-hisab-head,.reference-shell .agent-report-card form { grid-template-columns:minmax(0,1fr) 115px auto; }
  .reference-shell .agent-hisab-market .ref-table th,.reference-shell .agent-hisab-market .ref-table td,.reference-shell .agent-report-card .ref-table th,.reference-shell .agent-report-card .ref-table td,.reference-shell.view-village-hisab .ref-table th,.reference-shell.view-village-hisab .ref-table td { font-size:10px; }
}

/* Keep the Agent Sell form consistent across phone and browser widths. */
@media screen {
  .agent-shell .agent-sell-heading { flex-wrap:wrap; }
  .agent-shell .agent-sell-heading h2 { flex-basis:100%; }
  .agent-shell .agent-sell-heading>div { margin-left:auto; }
  .agent-shell .agent-game-selects { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .agent-shell .agent-entry-inputs { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .agent-shell .agent-entry-inputs>.btn { grid-column:2; }
  .agent-shell .agent-entry-inputs .agent-number-field { grid-column:2; }
}

/* Keep weekly Agent Hisab as compact as the other Admin screens. */
@media screen {
  .reference-shell .hisab-report-heading { gap:12px; margin-bottom:12px; }
  .reference-shell .hisab-report-heading>div { min-width:0; }
  .reference-shell .hisab-report-heading h2 { margin:0 0 3px; font-size:20px; line-height:1.3; }
  .reference-shell .hisab-report-heading p { font-size:12px; line-height:1.5; }
  .reference-shell .hisab-actions { gap:5px; }
  .reference-shell .hisab-actions .btn { min-height:32px; padding:5px 10px; font-size:12px; line-height:20px; }
  .reference-shell .hisab-filter { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 12px; }
  .reference-shell .hisab-filter>.field { margin:0; gap:0; }
  .reference-shell .hisab-filter .field label { margin:0 0 4px; font-size:12px; line-height:1.4; }
  .reference-shell .hisab-filter .field input,.reference-shell .hisab-filter .field select { display:block; box-sizing:border-box; min-width:0; max-width:100%; width:100%; min-height:34px; height:34px; padding:6px 9px; font-size:13px; line-height:20px; }
  .reference-shell .hisab-filter>.btn { min-height:34px; height:34px; padding:6px 10px; font-size:12px; line-height:20px; }
  .reference-shell .hisab-help { margin:10px 0 0; padding:8px 10px; border-radius:4px; font-size:12px; line-height:1.5; }
  .reference-shell .hisab-report .hisab-metrics { gap:8px; margin-bottom:15px; }
  .reference-shell .hisab-report .hisab-metrics article { gap:5px; padding:12px; border-radius:4px; }
  .reference-shell .hisab-report .hisab-metrics strong { font-size:17px; }
  .reference-shell .hisab-entry-forms { gap:10px; margin-bottom:15px; }
  .reference-shell .hisab-entry-forms details { padding:12px; border-radius:4px; }
  .reference-shell .hisab-entry-forms summary { font-size:14px; line-height:1.5; }
  .agent-shell .common-receipt-notice { margin:6px 8px; padding:7px 10px; font-size:11px; line-height:1.5; }
  .agent-shell .agent-entry-actions { justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
  .agent-shell .agent-entry-modes,.agent-shell .agent-entry-utilities { display:flex; gap:5px; }
  .agent-shell .agent-entry-utilities { margin-left:auto; }
  .agent-shell .agent-entry-modes .btn { min-height:32px; padding:5px 12px; }
  .agent-shell .agent-wp-fields { display:grid; grid-template-columns:120px minmax(0,1fr); gap:10px; align-items:start; }
  .agent-shell .agent-wp-fields .field { margin:0; }
  .agent-shell .agent-wp-fields label { display:block; margin-bottom:4px; font-size:12px; }
  .agent-shell .agent-wp-fields select { width:100%; min-height:36px; padding:6px 8px; border-radius:4px; font-size:13px; }
  .agent-shell .agent-wp-fields textarea { display:block; width:100%; min-width:0; min-height:100px; resize:vertical; padding:8px 10px; font-size:16px; line-height:1.5; font-variant-numeric:tabular-nums; border-radius:4px; }
  .agent-shell .agent-wp-fields small { display:block; margin-top:5px; font-size:11px; line-height:1.5; color:var(--mk-muted); }
  .agent-shell .agent-wp-fields .form-actions { grid-column:2; margin:0; justify-content:flex-end; }
}

@media screen and (max-width:900px) {
  .reference-shell .hisab-filter { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media screen and (max-width:600px) {
  .agent-shell .agent-wp-fields { grid-template-columns:85px minmax(0,1fr); gap:8px; }
  .reference-shell .hisab-report-heading { flex-direction:column; align-items:stretch; gap:8px; }
  .reference-shell .hisab-report-heading .hisab-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .reference-shell .hisab-report-heading .hisab-actions .btn { width:100%; min-width:0; padding-left:6px; padding-right:6px; }
  .reference-shell .hisab-filter { gap:8px 10px; }
  .reference-shell .hisab-filter .field label { font-size:11px; }
  .reference-shell .hisab-filter .field input,.reference-shell .hisab-filter .field select { padding-left:7px; padding-right:7px; font-size:12px; }
  .reference-shell .hisab-report .hisab-metrics strong { font-size:15px; }
}

/* Emphasize operational information while keeping help text lighter. */
@media screen {
  .app-shell h1,.app-shell h2,.app-shell h3,.app-shell .btn,
  .app-shell .field label,.app-shell .ref-check,.app-shell .agent-active-toggle,
  .app-shell .agent-profile-form>.field>label,.app-shell .agent-profile-form .ref-check,
  .app-shell .ref-rate-row>.field>label,.app-shell .hisab-filter .field label,
  .app-shell .agent-wp-fields label { font-weight:700; }
  .app-shell .field input,.app-shell .field select,.app-shell .field textarea,
  .app-shell .agent-game-selects select,.app-shell .agent-entry-inputs input,
  .app-shell .agent-entry-inputs select,.app-shell .agent-wp-fields select,
  .app-shell .agent-wp-fields textarea { font-weight:600; }
  .app-shell .ref-table th,.app-shell .table th,.app-shell .agent-entry-table th { font-weight:700; }
  .app-shell .ref-table td,.app-shell .table td,.app-shell .agent-report-card .ref-table td { font-weight:600; }
  .app-shell .agent-directory-name strong,.app-shell .agent-directory-mobile,
  .app-shell .agent-directory-points strong,.app-shell .agent-directory-status,
  .app-shell .hisab-metrics span,.app-shell .hisab-status,.app-shell .pill { font-weight:700; }
  .app-shell .agent-top-strip,.app-shell .ref-point-badge,
  .app-shell .agent-draft-total,.app-shell .total-bar,
  .app-shell .agent-hisab-final dt,.app-shell .agent-hisab-final dd,
  .app-shell .agent-final-hisab>div,.app-shell .agent-final-hisab>div strong,
  .app-shell.view-village-hisab .ref-dark-panel>div:not(.table-wrap),
  .app-shell .hisab-metrics strong,.app-shell .ref-points-banner strong { font-weight:700; }
}

/* Daily Hisab: give the product list priority and keep the final summary compact. */
@media screen {
  .reference-shell .hisab-summary-card { padding:16px; }
  .reference-shell .hisab-summary-head {
    display:grid; grid-template-columns:minmax(0,1fr) 190px;
    align-items:center; gap:12px; margin-bottom:16px;
  }
  .reference-shell .hisab-summary-head h2 { grid-column:auto; margin:0!important; overflow-wrap:anywhere; }
  .reference-shell .hisab-summary-head .field { min-width:0; margin:0; width:100%; }
  .reference-shell .hisab-summary-head .field label { display:block; margin:0 0 4px; font-size:12px; }
  .reference-shell .hisab-summary-head input[type=date] {
    box-sizing:border-box; display:block; width:100%; min-width:0; max-width:100%;
    min-height:42px; padding:8px 10px; font-size:15px; line-height:1.3;
    color:var(--mk-ink); background:#fff; font-variant-numeric:tabular-nums; color-scheme:light;
  }
  .reference-shell .hisab-summary-head input[type=date]::-webkit-date-and-time-value { text-align:left; }
  .reference-shell .hisab-summary-head input[type=date]::-webkit-calendar-picker-indicator { margin-left:4px; padding:0; flex-shrink:0; opacity:1; }
  .reference-shell .hisab-summary-card .ref-table { table-layout:fixed; width:100%; min-width:0; }
  .reference-shell .hisab-summary-card .ref-table th,
  .reference-shell .hisab-summary-card .ref-table td { padding:10px 5px; font-size:13px; letter-spacing:0; }
  .reference-shell .hisab-summary-card .ref-table th:first-child,
  .reference-shell .hisab-summary-card .ref-table td:first-child { width:30%; text-align:left; white-space:normal; overflow-wrap:break-word; font-size:14px; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(2),
  .reference-shell .hisab-summary-card .ref-table th:nth-child(3) { width:10%; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(4) { width:16%; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(5),
  .reference-shell .hisab-summary-card .ref-table th:nth-child(6) { width:17%; white-space:normal; }
  .reference-shell .hisab-summary-card .ref-table td:not(:first-child) { white-space:nowrap; font-variant-numeric:tabular-nums; }
  .reference-shell .hisab-final-card { padding:14px 16px; }
  .reference-shell .hisab-final-card h2,.reference-shell .hisab-final-card h3 { font-size:18px; margin:0 0 10px; }
  .reference-shell .hisab-final-card dl { margin:0 0 10px; }
  .reference-shell .hisab-final-card dl>div,
  .reference-shell .hisab-final-card>div:not(.notice) { padding:6px 4px; font-size:13px; line-height:1.4; }
  .reference-shell .hisab-final-card>.btn { min-height:34px; padding:7px 10px; font-size:12px; }
}
@media screen and (max-width:600px) {
  .reference-shell .hisab-summary-head { grid-template-columns:minmax(0,1fr) 178px; gap:8px; }
  .reference-shell .hisab-summary-card .ref-table th,
  .reference-shell .hisab-summary-card .ref-table td { font-size:clamp(10.5px,2.95vw,13px); padding:10px 3px; }
  .reference-shell .hisab-summary-card .ref-table th:first-child,
  .reference-shell .hisab-summary-card .ref-table td:first-child { font-size:clamp(12px,3.5vw,14px); }
}
@media screen and (max-width:360px) {
  .reference-shell .hisab-summary-card { padding:12px 8px; }
  .reference-shell .hisab-summary-head { grid-template-columns:minmax(0,1fr) 170px; }
  .reference-shell .hisab-summary-head h2 { font-size:16px; }
  .reference-shell .hisab-summary-head input[type=date] { font-size:14px; }
}

/* Readable daily figures and compact cutting controls on phones. */
@media screen {
  .reference-shell .hisab-summary-card .table-wrap { overflow-x:auto; }
  .reference-shell .hisab-summary-card .ref-table { table-layout:auto; width:100%; min-width:100%; }
  .reference-shell .hisab-summary-card .ref-table th:first-child,
  .reference-shell .hisab-summary-card .ref-table td:first-child { width:25%; min-width:70px; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(2),
  .reference-shell .hisab-summary-card .ref-table th:nth-child(3) { width:12%; min-width:32px; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(4) { width:14%; min-width:40px; }
  .reference-shell .hisab-summary-card .ref-table th:nth-child(5),
  .reference-shell .hisab-summary-card .ref-table th:nth-child(6) { width:18.5%; min-width:50px; white-space:nowrap; }
  .reference-shell .hisab-summary-card .ref-table th:not(:first-child),
  .reference-shell .hisab-summary-card .ref-table td:not(:first-child) { text-align:right; white-space:nowrap; }
  .reference-shell .ref-cutting-top { padding:16px; }
  .reference-shell .ref-cutting-top .ref-panel-head { align-items:center; gap:8px; padding-bottom:8px; margin-bottom:4px; }
  .reference-shell .ref-cutting-top .ref-panel-head h2 { flex:1 1 auto; min-width:0; overflow-wrap:anywhere; font-size:18px; }
  .reference-shell .ref-cutting-top-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:5px; }
  .reference-shell .ref-cutting-top-actions .btn { min-height:30px; padding:4px 9px; font-size:11px; line-height:18px; }
  .reference-shell .ref-cutting-top .ref-cutting-summary { padding:7px 0; gap:8px; font-size:12px; }
  .reference-shell .ref-cutting-top .ref-cutting-summary strong { font-size:14px; white-space:nowrap; }
  .reference-shell .ref-cutting-top #cutting-form { display:flex; align-items:end; gap:8px; }
  .reference-shell .ref-cutting-top #cutting-form .field { flex:1; margin:0; }
  .reference-shell .ref-cutting-top #cutting-form label { margin-bottom:4px; }
  .reference-shell .ref-cutting-top #cutting-form .btn { min-height:36px; padding:6px 14px; }
}
@media screen and (max-width:600px) {
  .reference-shell .hisab-summary-card .ref-table th,
  .reference-shell .hisab-summary-card .ref-table td { font-size:12px; padding:10px 4px; }
  .reference-shell .hisab-summary-card .ref-table th:first-child,
  .reference-shell .hisab-summary-card .ref-table td:first-child { font-size:13px; }
  .reference-shell .ref-cutting-top { padding:12px; }
}

/* Keep both Agent and Village Hisab summaries consistent and easy to read. */
@media screen {
  .reference-shell.view-agent-hisab .hisab-summary-card,
  .reference-shell.view-village-hisab .hisab-summary-card { padding:18px 12px; }
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table td,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td { font-size:14px; padding:12px 5px; }
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table td:first-child,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:first-child { font-size:15px; min-width:85px; }
  .reference-shell.view-agent-hisab .hisab-final-card,
  .reference-shell.view-village-hisab .hisab-final-card { padding:12px 14px; }
  .reference-shell.view-agent-hisab .hisab-final-card h2,
  .reference-shell.view-village-hisab .hisab-final-card h2 { font-size:17px; margin-bottom:8px; }
  .reference-shell.view-agent-hisab .hisab-final-card dl>div,
  .reference-shell.view-village-hisab .hisab-final-card dl>div { padding:5px 3px; font-size:13px; }
}

/* Readable figures and compact full-width Hisab on phone screens. */
@media screen {
  .reference-shell { font-size:16px; }
  .reference-shell .ref-table th, .reference-shell .ref-table td { font-size:14px; }
  .reference-shell .field label { font-size:14px; font-weight:700; }
  .reference-shell input, .reference-shell select, .reference-shell textarea { font-size:16px; }
  .reference-shell .market-board-tile { background:#a52e38; color:#fff; }
  .reference-shell .market-board-tile.winning { background:#f4d66c; color:#172b22; outline:2px solid #c49a35; outline-offset:-2px; }
  .reference-shell .market-board-tile strong, .reference-shell .market-board-tile span { font-size:18px; font-weight:700; line-height:1.2; }
  .reference-shell .board-jodi .market-board-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .reference-shell .board-jodi .market-board-tile { min-height:70px; }
  .reference-shell .market-board-ank { font-size:16px; font-weight:700; }
  .reference-shell .win-result { text-align:center; color:#a52e38; font-size:19px; font-weight:700; margin:12px 0; }
  .board-language-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
  .reference-shell .hisab-summary-card .table-wrap { width:100%; overflow-x:auto; }
  .reference-shell .hisab-summary-card .ref-table { width:100%; min-width:100%; }
}
@media screen and (max-width:600px) {
  /* Keep the daily Hisab summary visible together on ordinary phone screens. */
  .reference-shell.view-agent-report .ref-points-banner { padding:9px 12px; margin-bottom:8px; }
  .reference-shell.view-agent-report .ref-points-banner strong { font-size:17px; line-height:1.2; }
  .reference-shell.view-agent-report .agent-report-card,
  .reference-shell.view-agent-report .agent-final-hisab { margin-bottom:8px; padding:9px 8px; }
  .reference-shell.view-agent-report .agent-report-card form { margin-bottom:8px; }
  .reference-shell.view-agent-report .agent-report-card h2 { font-size:17px; margin:0; }
  .reference-shell.view-agent-report .agent-final-hisab h3 { font-size:17px; margin:0 0 5px; }
  .reference-shell.view-agent-report .agent-final-hisab > div { padding:4px 3px; line-height:1.25; }
  .reference-shell .hisab-summary-card { padding:12px 5px; }
  .reference-shell .hisab-summary-card .ref-table th, .reference-shell .hisab-summary-card .ref-table td { font-size:13px; padding:10px 4px; }
  .reference-shell .board-jodi .market-board-grid, .reference-shell .board-pana .market-board-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .reference-shell .market-board-tile strong, .reference-shell .market-board-tile span { font-size:clamp(16px,4vw,18px); overflow-wrap:anywhere; }
}
@media screen {
  .draft-row-actions { display:flex; gap:4px; align-items:center; }
  .reference-shell .draft-row-actions .btn { padding:5px 7px; min-height:32px; font-size:12px; }
}
/* Compact Hisab rows preserve full table width on small screens. */
@media screen {
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table { width:100%; }
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table td,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td { padding:5px 4px; line-height:1.2; }
}
@media screen {
  .agent-entry-table input, .agent-entry-table select { width:100%; min-width:0; padding:5px 3px; font-size:14px; }
  .agent-entry-table [data-draft-field="side"] { min-width:55px; }
  .agent-entry-table [data-draft-field="category"] { min-width:85px; }
  .agent-entry-table [data-draft-field="number"], .agent-entry-table [data-draft-field="points"] { min-width:58px; }
}
.report-date-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.report-date-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; text-align:center; margin-top:10px; }
.report-date-grid b { font-size:12px; }
.report-date-grid .btn { padding:6px 0; min-width:0; min-height:36px; }
.agent-language-switch { display:flex; justify-content:flex-end; margin-bottom:8px; }
.reference-shell .agent-directory-details.agent-directory-controls { display:block; padding:8px 10px; }
.reference-shell .agent-directory-controls .agent-directory-actions { padding:0; border:0; }
@media screen {
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:not(:first-child),
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table tfoot th:not(:first-child) {
    font-size:17px; line-height:1.2; font-variant-numeric:tabular-nums;
  }
}
@media screen and (max-width:600px) {
  .reference-shell.view-agent-report .hisab-summary-card,
  .reference-shell.view-agent-hisab .hisab-summary-card,
  .reference-shell.view-village-hisab .hisab-summary-card { box-sizing:border-box; width:100%; padding:12px 5px; }
  .reference-shell.view-agent-report .hisab-summary-card .table-wrap,
  .reference-shell.view-agent-hisab .hisab-summary-card .table-wrap,
  .reference-shell.view-village-hisab .hisab-summary-card .table-wrap { overflow-x:visible; }
  .reference-shell.view-agent-report .hisab-summary-card .ref-table,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table { width:100%; min-width:0; table-layout:fixed; }
  .reference-shell.view-agent-report .hisab-summary-card .ref-table th,
  .reference-shell.view-agent-report .hisab-summary-card .ref-table td,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table td,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td { min-width:0; padding:5px 2px; font-size:clamp(11px,3.1vw,14px); line-height:1.2; white-space:normal; overflow-wrap:anywhere; }
  .reference-shell.view-agent-report .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-agent-report .hisab-summary-card .ref-table td:first-child,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-agent-hisab .hisab-summary-card .ref-table td:first-child,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:first-child { width:25%; min-width:0; font-size:clamp(12px,3.2vw,14px); }
  .reference-shell.view-agent-report .hisab-summary-card .ref-table th,
  .reference-shell.view-agent-report .hisab-summary-card .ref-table td { padding:4px 3px; line-height:1.15; }
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:not(:first-child),
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table tfoot th:not(:first-child) {
    font-size:clamp(15px,4vw,17px); line-height:1.2; font-variant-numeric:tabular-nums;
  }
}

/* Village Hisab: keep each amount on one line in equal-width columns. */
@media screen and (max-width:600px) {
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th:first-child,
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:first-child { width:25%; }
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table thead th:nth-child(n+2) { width:15%; min-width:0; }
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table th:not(:first-child),
  .reference-shell.view-village-hisab .hisab-summary-card .ref-table td:not(:first-child) { white-space:nowrap; padding-left:0; padding-right:1px; overflow-wrap:normal; }
  .reference-shell.view-village-hisab .hisab-number { display:block; width:125%; margin-left:-25%; transform:scaleX(.8); transform-origin:right center; font-variant-numeric:proportional-nums; }
}

/* Eight compact Jodi tiles per row on every board. */
@media screen {
  .reference-shell .board-jodi .market-board-grid { grid-template-columns:repeat(8,minmax(0,1fr)); }
  .reference-shell .board-jodi .market-board-tile { min-width:0; min-height:48px; padding:3px 0; gap:2px; }
  .reference-shell .board-jodi .market-board-tile strong,
  .reference-shell .board-jodi .market-board-tile span { font-size:clamp(13px,3.8vw,18px); line-height:1.15; font-weight:700; overflow-wrap:anywhere; }
}
