/* Shared visual language from the original Globex TMS. Print layouts retain their own styles. */
@media screen {
    :root {
        --teal: #34498a; --navy: #16213e; --navy2: #22304f;
        --ink: #16213e; --muted: #44506b; --line: #dfe4ef; --bg: #f5f7fc;
        --tms-soft: #eaf0fb; --tms-accent: #34498a; --tms-input: #7b88a8;
        --tms-shadow: none;
    }
    body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); -webkit-font-smoothing: antialiased; }
    button, input, select, textarea { font: inherit; }
    [hidden] { display: none !important; }
    :focus-visible { outline: 2px solid #4f6cb4; outline-offset: 3px; }
    .shell { grid-template-columns: 264px minmax(0, 1fr); }
    .shell .main { min-width: 0; }
    .shell .content { width: 100%; max-width: 1640px; margin: 0 auto; padding: 32px 32px 0; }
    .shell .page-intro { margin-bottom: 24px; gap: 20px; }
    .shell .page-intro h1 { font-size: clamp(24px, 2vw, 30px); letter-spacing: -.025em; line-height: 1.25; }
    .shell .page-intro .muted { margin-top: 8px; font-size: 14px; line-height: 1.5; }
    .shell .eyebrow { font-size: 13px; letter-spacing: .08em; margin-bottom: 8px; }
    .shell .date-badge { background: #ffffff; border: 1px solid var(--line); padding: 9px 12px; border-radius: 4px; font-size: 13px; }

    .shell .sidebar, .workspace-enhanced .shell .sidebar {
        padding: 0; background: #ffffff; color: #2b3550; border-right: 1px solid var(--line);
        box-shadow: none; height: 100vh; height: 100dvh; overflow: hidden;
    }
    .shell .sidebar-brand-row {
        flex-shrink: 0; min-height: 72px; height: 72px; margin: 0; padding: 0 44px;
        border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
    }
    .shell .brand, .shell .brand .brand-full, .shell .brand .brand-short { padding: 0; margin: 0; min-width: 0; background: transparent; border: 0; box-shadow: none; }
    .shell .brand .brand-logo { width: auto; height: 48px; max-width: 120px; max-height: 48px; object-fit: contain; }
    .sidebar-tms-badge { position: absolute; right: 12px; padding: 2px 8px; border: 1px solid #c9d4ea; border-radius: 999px; color: var(--tms-accent); background: var(--tms-soft); font-size: 13px; font-weight: 700; letter-spacing: .1em; }
    .shell .sidebar-toolbar { margin: 0; padding: 14px 20px 8px; color: var(--muted); font-size: 13px; letter-spacing: .07em; text-transform: uppercase; }
    .shell .sidebar-resize { width: 28px; height: 28px; color: var(--tms-accent); background: #ffffff; border: 1px solid var(--line); border-radius: 4px; }
    .shell .sidebar-search { margin: 0 16px 12px; padding: 0 10px; min-height: 38px; background: #f7f9fd; border: 1px solid var(--tms-input); border-radius: 4px; box-shadow: none; }
    .shell .sidebar-search input { color: var(--ink); font-size: 13px; }
    .shell .sidebar-search kbd { display: none; }
    .shell .sidebar-empty { margin: 0 16px; font-size: 13px; }
    .shell .workspace-navigation, .workspace-enhanced .shell .workspace-navigation { padding: 12px; margin: 0; border-top: 1px solid var(--line); scrollbar-color: #c9d4ea transparent; }
    .shell .nav-group { --group-accent: #34498a; --group-tint: #eaf0fb; margin: 0 0 3px; padding: 0; background: transparent; border: 0; border-radius: 4px; box-shadow: none; }
    .shell [data-nav-group="Master"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="HR"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Partner"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Quotation"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Sales"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Operation"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Workshop"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Finance"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell [data-nav-group="Accounting"] { --group-accent: #34498a; --group-tint: #eaf0fb; }
    .shell .nav-caption, .shell .nav-group[open] > .nav-caption { display: flex; align-items: center; gap: 12px; padding: 6px 10px; min-height: 42px; margin: 0; border: 0; border-radius: 4px; background: transparent; box-shadow: none; color: #2b3550; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; }
    .shell .nav-caption:hover { background: #edf0f6; }
    .shell .nav-group-active > .nav-caption { color: var(--tms-accent); background: var(--tms-soft); }
    .shell .group-chevron { order: 3; margin-left: auto; color: #7b88a8; width: 14px; height: 14px; flex: 0 0 14px; }
    .shell .group-icon { width: 30px; height: 30px; flex: 0 0 30px; padding: 6px; border-radius: 4px; color: var(--group-accent); background: var(--group-tint); }
    .shell .nav-group-items { margin: 3px 0 7px 24px; padding: 0 0 0 12px; border-left: 1px solid var(--line); background: transparent; }
    .shell .nav-link { display: flex; align-items: center; gap: 6px; min-height: 35px; margin: 1px 0; padding: 6px 10px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 500; line-height: 1.4; box-shadow: none; }
    .shell .nav-link:hover { background: #edf0f6; color: var(--ink); }
    .shell .nav-link.active { background: var(--tms-soft); color: var(--tms-accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--teal); }
    .shell .nav-item-mark { display: none; }
    .shell .nav-section { margin: 3px 0; border: 0; background: transparent; }
    .shell .nav-section-caption { padding: 7px 8px; min-height: 34px; font-size: 13px; color: #2b3550; background: transparent; border: 0; }
    .shell .nav-section-active > .nav-section-caption { color: var(--tms-accent); }
    .shell .nav-section-items { margin-left: 8px; padding-left: 4px; }
    .shell .sidebar-footer { margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); background: #ffffff; font-size: 13px; color: var(--muted); }
    .shell .sidebar-footer a { color: var(--tms-accent); font-size: 13px; }

    .shell .topbar { min-height: 72px; padding: 14px 32px; gap: 20px; border-bottom: 1px solid var(--line); background: #ffffff; box-shadow: none; }
    .shell .topbar-kicker { color: var(--muted); font-size: 13px; letter-spacing: .08em; }
    .shell .topbar-heading > strong { color: var(--ink); font-size: 14px; }
    .shell .global-search { width: 240px; max-width: 30%; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fd; }
    .shell .global-search input { min-height: 36px; font-size: 13px; }
    .shell .global-search button { font-size: 13px; color: var(--tms-accent); }
    .shell .account { gap: 12px; }
    .shell .account-avatar { width: 36px; height: 36px; border-radius: 4px; background: var(--tms-soft); color: var(--tms-accent); font-size: 13px; }
    .shell .account-name strong { font-size: 13px; }
    .shell .account-name small { font-size: 13px; }
    .shell .logout { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; color: #2b3550; font-size: 13px; }
    .shell .menu-toggle { border: 1px solid var(--line); color: var(--tms-accent); border-radius: 4px; background: #ffffff; }

    .shell .card { padding: 24px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--tms-shadow); background: #ffffff; }
    .shell .card-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
    .shell .card-header h2, .shell .card h2 { font-size: 17px; letter-spacing: -.01em; }
    .shell .card-header p { margin-top: 4px; font-size: 13px; color: var(--muted); }
    .shell .button, .tms-login .button { min-height: 40px; padding: 9px 16px; border: 1px solid var(--teal); border-radius: 4px; background: var(--teal); color: #ffffff; font-size: 14px; font-weight: 600; line-height: 1.4; box-shadow: none; }
    .shell .button:hover, .tms-login .button:hover { background: #2b3d77; border-color: #2b3d77; }
    .shell .button.secondary { background: #ffffff; color: #2b3550; border-color: #c9d4ea; box-shadow: none; }
    .shell .button.secondary:hover { background: #f7f9fd; color: var(--ink); border-color: #7b88a8; }
    .shell .button.small { min-height: 34px; padding: 7px 12px; font-size: 14px; }
    .shell .button.danger { color: #a82a3c; background: #fbe9ec; border-color: #f0c4cc; }
    .shell .field { margin-bottom: 18px; }
    .shell .field label, .tms-login .field label { font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #2b3550; }
    .shell .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .shell .field select, .shell .field textarea, .shell .search-input, .shell .filter-bar input:not([type=checkbox]):not([type=radio]), .shell .filter-bar select, .tms-login .field input { min-height: 42px; padding: 10px 12px; font-size: 14px; line-height: 1.4; border: 1px solid var(--tms-input); border-radius: 4px; color: var(--ink); background-color: #ffffff; box-shadow: none; }
    .shell .field input:focus-visible, .shell .field select:focus-visible, .shell .field textarea:focus-visible, .tms-login .field input:focus-visible { outline: 2px solid #4f6cb4; outline-offset: 0; box-shadow: 0 0 0 4px rgb(52 73 138 / .18); }
    .shell .field input[readonly] { background: #f7f9fd; border-style: dashed; }
    .shell .field input:disabled, .shell .field select:disabled { background: #edf0f6; color: var(--muted); }
    .shell .field small { font-size: 13px; line-height: 1.5; }
    .shell .form-grid, .shell .details-grid { gap: 20px; }
    .shell .filter-bar { gap: 12px; margin-bottom: 20px; padding: 16px; background: #f7f9fd; border: 1px solid var(--line); border-radius: 4px; }
    .shell .filter-bar .field { margin: 0; }
    .shell .table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
    .shell table { font-size: 13px; line-height: 1.5; }
    .shell .table-wrap th, .shell th { padding: 11px 16px; background: #f7f9fd; color: #44506b; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
    .shell .table-wrap td, .shell td { padding: 13px 16px; color: #2b3550; border-bottom: 1px solid #edf0f6; }
    .shell tbody tr:hover td { background: #f7f9fd; }
    .shell td small { font-size: 13px; margin-top: 3px; }
    .shell td a:not(.button) { color: var(--tms-accent); font-weight: 600; }
    .shell .badge { padding: 4px 9px; font-size: 13px; font-weight: 600; line-height: 1.4; border-radius: 999px; }
    .shell .alert { font-size: 14px; padding: 13px 16px; border: 1px solid #b9dfca; border-left: 4px solid #1e7552; background: #e4f3eb; color: #1e7552; }
    .shell .alert.error { background: #fbe9ec; color: #a82a3c; border-color: #f0c4cc; border-left-color: #a82a3c; }
    .shell .pagination { gap: 6px; font-size: 13px; }
    .shell .empty-state { padding: 40px 24px; }
    .shell .empty-state h3 { font-size: 16px; }
    .shell .empty-state p { font-size: 13px; }
    .shell .workspace-footer { margin-top: 24px; padding: 20px 0; font-size: 13px; color: var(--muted); }

    .shell .summary-grid, .shell .summary-grid.three { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
    .shell .summary-card { --stat-accent: #34498a; --stat-tint: #eaf0fb; position: relative; overflow: hidden; padding: 20px; background: #ffffff; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--tms-shadow); }
    .shell .summary-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--stat-accent); }
    .shell .summary-card:nth-child(2) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
    .shell .summary-card:nth-child(3) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
    .shell .summary-card:nth-child(4) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
    .shell .summary-card:nth-child(5) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
    .shell .summary-card-icon { float: right; width: 38px; height: 38px; margin-left: 8px; padding: 9px; border-radius: 4px; color: var(--stat-accent); background: var(--stat-tint); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
    .shell .summary-card-label { margin: 0 0 10px; color: #2b3550; font-size: 13px; font-weight: 600; }
    .shell .summary-card .stat { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
    .shell .summary-card-detail { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
    .shell .summary-card .card-link { color: var(--tms-accent); font-size: 13px; margin-top: 12px; }
    .shell .dashboard-workbench { display: grid; grid-template-columns: 1fr; gap: 0; }
    .shell .workflow-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
    .shell .workflow-row { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 4px; }
    .shell .workflow-number { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--teal); color: #ffffff; font-size: 13px; box-shadow: 0 0 0 4px var(--tms-soft); }
    .shell .workflow-row h3 { font-size: 15px; margin-bottom: 6px; }
    .shell .workflow-row p { font-size: 13px; line-height: 1.6; }
    .shell .workflow-row > a { margin-top: auto; font-size: 13px; }
    .shell .attention-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
    .shell .attention-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
    .shell .account-summary { margin-top: 20px; padding: 16px; background: #f7f9fd; border-radius: 4px; font-size: 13px; }
    .shell .account-summary p { font-size: 13px; }

    .shell .master-catalogue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; margin-bottom: 24px; }
    .shell .master-category { --master-accent: #34498a; --master-tint: #eaf0fb; margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; box-shadow: var(--tms-shadow); overflow: hidden; }
    .shell [data-master-section="Finance"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="Sales"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="Operation"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="Workshop"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="Regional"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="Vehicle"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell [data-master-section="HR"] { --master-accent: #34498a; --master-tint: #eaf0fb; }
    .shell .master-category > summary { display: flex; align-items: center; gap: 10px; min-height: 80px; padding: 18px 14px; background: #ffffff; color: #2b3550; font-size: 14px; font-weight: 600; border: 0; }
    .shell .master-category > summary:hover, .shell .master-category[open] > summary { background: var(--master-tint); color: var(--master-accent); }
    .shell .master-category-icon { width: 36px; height: 36px; flex: 0 0 36px; padding: 9px; border-radius: 4px; color: var(--master-accent); background: var(--master-tint); }
    .shell .master-category-count { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: #edf0f6; color: #2b3550; font-size: 13px; }
    .shell .master-category-links { padding: 8px; border-top: 3px solid var(--master-accent); background: #ffffff; }
    .shell .master-category-links a { min-height: 40px; padding: 9px 10px; border: 0; border-radius: 4px; font-size: 13px; }
    .shell .master-category-links a:hover { color: var(--tms-accent); background: #f7f9fd; }
    .shell .master-link-arrow { display: none; }
    .shell .master-authorized { padding: 20px 24px; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; box-shadow: var(--tms-shadow); }

    .tms-login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }
    .tms-login-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px clamp(32px, 5vw, 80px); background: linear-gradient(150deg, #16213e 0%, #22304f 100%); color: #ffffff; }
    .tms-login-story::before, .tms-login-story::after { content: ""; position: absolute; width: 650px; height: 650px; right: -340px; bottom: -290px; border: 1px solid rgb(255 255 255 / .07); border-radius: 50%; pointer-events: none; }
    .tms-login-story::after { width: 450px; height: 450px; right: -240px; bottom: -190px; }
    .tms-login-logo { width: 168px; padding: 12px 18px; border-radius: 4px; background: #ffffff; box-shadow: none; }
    .tms-login-logo img { display: block; width: 100%; height: auto; }
    .tms-login-story-content { position: relative; max-width: 460px; padding: 48px 0; }
    .tms-login-story .eyebrow { margin-bottom: 20px; color: #ccd6ea; font-size: 13px; letter-spacing: .08em; }
    .tms-login-story h2 { margin: 0 0 24px; font-size: clamp(32px, 3.2vw, 48px); line-height: 1.15; letter-spacing: -.025em; }
    .tms-login-story p { color: #dfe4ef; font-size: 16px; line-height: 1.7; }
    .tms-login-features { display: grid; gap: 16px; margin-top: 32px; }
    .tms-login-features > div { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #edf0f6; }
    .tms-login-features svg { flex: 0 0 32px; width: 32px; height: 32px; padding: 7px; border-radius: 4px; background: rgb(255 255 255 / .10); color: #ccd6ea; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .tms-login-story > small { position: relative; font-size: 13px; color: #dfe4ef; }
    .tms-login-side { display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: 40px; background: var(--bg); }
    .tms-login-card { width: min(100%, 440px); margin: 0 auto; padding: 36px 32px; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; box-shadow: none; }
    .tms-login-card h1 { margin-bottom: 12px; font-size: 28px; line-height: 1.25; letter-spacing: -.02em; }
    .tms-login-card > .muted { margin-bottom: 24px; font-size: 14px; }
    .tms-login-tabs { display: flex; gap: 4px; margin-bottom: 24px; padding: 4px; border-radius: 4px; background: #edf0f6; }
    .tms-login-tabs a { flex: 1; position: relative; padding: 9px 8px; border-radius: 4px; color: #2b3550; font-size: 13px; font-weight: 600; text-align: center; }
    .tms-login-tabs a[aria-selected="true"] { background: #ffffff; color: var(--tms-accent); box-shadow: 0 1px 2px rgb(22 33 62 / .10), 0 0 0 1px var(--line); }
    .tms-login-tabs a[aria-selected="true"]::after { content: ""; position: absolute; bottom: 2px; left: 12px; right: 12px; height: 2px; border-radius: 2px; background: var(--teal); }
    .tms-login .field { margin: 0 0 18px; }
    .tms-login .field input { width: 100%; }
    .tms-login .button { width: 100%; min-height: 46px; justify-content: space-between; font-size: 15px; }
    .tms-password-field { position: relative; }
    .tms-login .tms-password-field input { padding-right: 44px; }
    .tms-password-field button { display: grid; place-items: center; position: absolute; right: 3px; top: 3px; width: 36px; height: 36px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; }
    .tms-password-field button:hover, .tms-password-field button[aria-pressed="true"] { background: var(--tms-soft); color: var(--tms-accent); }
    .tms-password-field svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
    .tms-caps-warning { color: #79521b; font-size: 13px; }
    .tms-login-options { text-align: right; margin: -4px 0 18px; font-size: 13px; color: var(--tms-accent); }
    .tms-login-help { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
    .tms-login-note { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.6; }
    .tms-login-note p + p { margin-top: 10px; }
    .tms-login-note a { color: var(--tms-accent); font-weight: 600; }
    .tms-login-home { text-align: center; font-size: 13px; color: var(--muted); }
    .tms-login-mobile-logo { display: none; }
    .tms-passkey-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 46px; margin-top: 12px; padding: 11px 16px; border: 1px solid #a7b3ce; border-radius: 4px; color: #2b4fc4; background: #f5f7fc; font: inherit; font-weight: 600; cursor: pointer; }
    .tms-passkey-button:hover:not(:disabled) { background: #e6ecf8; border-color: #34498a; }
    .tms-passkey-button:disabled, .auth-google-button:disabled { opacity: .58; cursor: not-allowed; }
    .tms-passkey-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
    .tms-passkey-button:focus-visible, .tms-passkey-help summary:focus-visible { outline: 3px solid #b9c5de; outline-offset: 3px; }
    .tms-passkey-help { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
    .tms-passkey-help summary { cursor: pointer; color: #2b4fc4; font-weight: 600; }
    .tms-passkey-help p { margin: 8px 0 0; padding: 10px 12px; border-radius: 4px; background: #f5f7fc; }
    .tms-passkey-security-link { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
    .tms-passkey-security-link p { margin-top: 6px; }
    .tms-passkey-management { max-width: 760px; margin-bottom: 20px; }
    .tms-passkey-management > p, .tms-passkey-management > .field, .tms-passkey-management > .alert { margin-top: 16px; }
    .tms-passkey-management .field { max-width: 440px; }
    .tms-passkey-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
    .tms-passkey-row:last-child { border-bottom: 0; padding-bottom: 0; }
    .tms-passkey-row p { margin-top: 5px; font-size: 13px; }
    .auth-aside { background: linear-gradient(150deg, #16213e, #22304f); }
    .auth-form { background: var(--bg); }
    .auth-form > div { padding: 32px; background: #ffffff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--tms-shadow); }
}

@media screen and (min-width: 901px) {
    .workspace-enhanced .shell.sidebar-collapsed { grid-template-columns: 88px minmax(0, 1fr); }
    .workspace-enhanced .shell.sidebar-collapsed .sidebar { padding: 0; }
    .shell.sidebar-collapsed .sidebar-brand-row { padding: 0 8px; }
    .shell.sidebar-collapsed .brand .brand-logo { max-width: 65px; height: 45px; }
    .shell.sidebar-collapsed .sidebar-tms-badge, .shell.sidebar-collapsed .sidebar-footer { display: none; }
    .workspace-enhanced .shell.sidebar-collapsed .workspace-navigation { margin: 0; padding: 12px 8px; }
    .shell.sidebar-collapsed .nav-group { margin: 0 0 5px; }
    .shell.sidebar-collapsed .nav-caption { min-height: 64px; padding: 7px 3px; gap: 5px; border: 0; border-radius: 4px; background: transparent; box-shadow: none; flex-direction: column; }
    .shell.sidebar-collapsed .nav-group-active > .nav-caption { background: var(--tms-soft); }
    .shell.sidebar-collapsed .group-icon { width: 30px; height: 30px; flex-basis: 30px; padding: 6px; }
    .shell.sidebar-collapsed .nav-caption-short { font-size: 13px; font-weight: 600; color: #2b3550; }
}
@media screen and (max-width: 1250px) {
    .shell:not(.sidebar-collapsed) { grid-template-columns: 244px minmax(0, 1fr); }
    .shell .content { padding: 26px 24px 0; }
    .shell .topbar { padding: 14px 24px; gap: 14px; }
    .shell .global-search { max-width: 28%; width: 200px; }
    .shell .master-catalogue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 900px) {
    .shell, .shell:not(.sidebar-collapsed) { display: block; }
    .workspace-enhanced .shell .sidebar { position: fixed; width: 280px; max-width: calc(100vw - 40px); padding: 0; }
    .workspace-enhanced .shell .sidebar-close { right: 8px; color: var(--tms-accent); background: #ffffff; border-color: var(--line); }
    .workspace-enhanced .shell .sidebar-tms-badge { right: 48px; }
    .workspace-enhanced .shell .sidebar-brand-row { padding-right: 75px; padding-left: 40px; }
    .shell .topbar { flex-wrap: wrap; min-height: 68px; padding: 14px 20px; }
    .shell .global-search { order: 3; max-width: none; width: 100%; }
    .shell .account { margin-left: auto; flex-wrap: wrap; gap: 8px; }
    .shell .account-name { display: none; }
    .shell .content { padding: 24px 20px 0; }
    .shell .workflow-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tms-login { grid-template-columns: minmax(300px, 42%) 1fr; }
    .tms-login-story { padding: 32px; }
    .tms-login-side { padding: 28px; }
    .tms-login-card { padding: 28px 24px; }
    .tms-login-story h2 { font-size: 34px; }
}
@media screen and (max-width: 700px) {
    .tms-login { display: block; }
    .tms-login-story { display: none; }
    .tms-login-side { min-height: 100dvh; padding: 24px 16px; }
    .tms-login-card { padding: 28px 24px; }
    .tms-login-mobile-logo { display: block; width: 90px; height: auto; margin: 0 auto 24px; }
    .tms-login-card h1 { font-size: 25px; }
    .tms-login .field input { font-size: 16px; }
}
@media screen and (max-width: 600px) {
    .shell .content { padding: 24px 16px 0; }
    .shell .page-intro h1 { font-size: 25px; }
    .shell .page-intro .muted { font-size: 13px; }
    .shell .topbar { padding: 12px 16px; }
    .shell .topbar-leading { flex: 1 0 100%; min-width: 0; order: 0; }
    .shell .account { flex: 1 0 100%; justify-content: flex-end; margin-left: 0; gap: 6px; order: 1; }
    .shell .global-search { order: 2; }
    .shell .account > .button { font-size: 15px; padding: 6px 8px; }
    .shell .card { padding: 18px; }
    .shell .summary-grid, .shell .summary-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .shell .summary-card { padding: 16px 14px; }
    .shell .summary-card .stat { font-size: 28px; }
    .shell .summary-card-icon { width: 28px; height: 28px; padding: 6px; }
    .shell .summary-card-label { font-size: 13px; }
    .shell .workflow-list { grid-template-columns: 1fr; }
    .shell .workflow-row { padding: 18px; }
    .shell .master-catalogue { gap: 10px; }
    .shell .master-category > summary { min-height: 72px; padding: 12px; gap: 8px; font-size: 13px; flex-wrap: wrap; }
    .shell .master-category-icon { width: 28px; height: 28px; flex-basis: 28px; padding: 6px; }
    .shell .master-category-count { padding: 2px 6px; }
    .shell .master-category[open] { grid-column: 1 / -1; }
    .shell .master-category-links a { min-height: 44px; }
    .shell .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .shell .field select, .shell .field textarea, .shell .search-input, .shell .filter-bar input, .shell .filter-bar select { font-size: 16px; }
    .shell .table-wrap td, .shell .table-wrap th { padding: 11px 12px; }
    .shell .form-grid, .shell .form-grid.three, .shell .details-grid { grid-template-columns: 1fr; gap: 16px; }
    .shell .workspace-footer { font-size: 13px; }
}
@media screen and (max-width: 360px) {
    .shell .master-catalogue, .shell .summary-grid, .shell .summary-grid.three { grid-template-columns: 1fr; }
}

/* Layout and document lists carried over from the original TMS workspace. */
@media screen {
  .tms-record-dialog { box-sizing: border-box; width: min(1000px, calc(100% - 40px)); max-width: calc(100% - 20px); padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; color: var(--ink); box-shadow: 0 24px 80px #16213e40; overflow: hidden; }
  .tms-record-dialog::backdrop { background: #16213e80; backdrop-filter: blur(2px); }
  .tms-record-dialog > header { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
  .tms-record-dialog h2 { font-size: 20px; margin: 0; flex: 1; }
  .tms-record-dialog .tms-dialog-page { color: var(--tms-accent); font-size: 13px; }
  .tms-record-dialog iframe { display: block; border: 0; width: 100%; height: min(720px, calc(100dvh - 150px)); background: #ffffff; }
  .tms-record-dialog .tms-dialog-loading { padding: 32px; }
}
@media screen and (max-width: 600px) {
  .tms-record-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 4px; }
  .tms-record-dialog > header { padding: 12px 16px; gap: 10px; }
  .tms-record-dialog h2 { font-size: 17px; }
  .tms-record-dialog iframe { height: calc(100dvh - 100px); }
}
@media screen {
  .shell .tms-page-head { align-items: flex-end; }
  .shell .page-intro h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; }
  .shell .tms-page-head .muted { margin: 0; }
  .shell .topbar { justify-content: space-between; }
  .shell .topbar-heading > strong { color: #2b3550; font-weight: 600; }
  .shell .account { margin-left: auto; }
  .shell .account-avatar { border-radius: 50%; }
  .shell .account-name { min-width: 0; max-width: 180px; }
  .shell .account-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .shell .account-attendance-badge { display: none; }
  .shell .menu-toggle { display: inline-flex; width: auto; gap: 6px; min-height: 40px; padding: 0 12px; }
  .shell .tms-menu-mode { font-size: 13px; font-weight: 600; }
  .shell .tms-notification-link, .shell .logout.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 10px; }
  .tms-account-tools { position: relative; }
  .tms-account-tools summary { cursor: pointer; list-style: none; }
  .tms-account-tools summary::-webkit-details-marker { display: none; }
  .tms-account-tools > div { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 210px; background: #ffffff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 8px 24px #16213e20; padding: 6px; }
  .tms-account-tools > div a { display: block; padding: 10px; border-radius: 4px; font-size: 13px; }
  .tms-account-tools > div a:hover { background: var(--tms-soft); }
  .shell .workspace-footer { display: none; }
  .shell .content { padding-bottom: 48px; }
  .shell .sidebar-toolbar { padding-top: 18px; }
  .shell .tms-nav-single-link { min-height: 42px; gap: 12px; font-size: 14px; font-weight: 600; color: #2b3550; }
  .shell .tms-nav-single-link.active { color: var(--tms-accent); }
  .shell .tms-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
  .tms-stat { --stat-accent: #34498a; --stat-tint: #eaf0fb; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label icon" "value icon"; gap: 8px 12px; align-items: start; position: relative; overflow: hidden; padding: 20px; background: #ffffff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--tms-shadow); text-decoration: none; }
  .tms-stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--stat-accent); }
  .tms-stat:nth-child(2) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
  .tms-stat:nth-child(3) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
  .tms-stat:nth-child(4) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
  .tms-stat:nth-child(5) { --stat-accent: #34498a; --stat-tint: #eaf0fb; }
  .tms-stat-icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 4px; color: var(--stat-accent); background: var(--stat-tint); }
  .tms-stat-icon svg { width: 20px; height: 20px; }
  .tms-stat-label { grid-area: label; font-size: 13px; font-weight: 600; line-height: 1.4; color: #2b3550; }
  .tms-stat strong { grid-area: value; color: var(--ink); font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .tms-stat:hover { border-color: var(--stat-accent); }
  .tms-panel { margin-bottom: 24px; background: #ffffff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--tms-shadow); overflow: hidden; }
  .tms-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
  .tms-panel-head h2 { margin: 0; font-size: 16px; }
  .tms-panel-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
  .tms-panel-body { padding: 24px; }
  .tms-flow-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .tms-flow-step { padding: 20px; background: #ffffff; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; }
  .tms-flow-step:hover { border-color: var(--teal); }
  .tms-flow-number { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px; border-radius: 50%; color: #ffffff; background: var(--teal); font-size: 13px; font-weight: 700; box-shadow: 0 0 0 4px var(--tms-soft); }
  .tms-flow-step h3 { font-size: 16px; margin: 0 0 6px; }
  .tms-flow-step p { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 0; }
  .tms-scope { font-size: 13px; }
  .tms-master-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 24px; }
  .tms-master-summary > span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 10px; background: #ffffff; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
  .tms-master-summary svg { width: 16px; height: 16px; stroke: currentColor; fill: none; color: var(--tms-accent); }
  .tms-master-summary strong { color: var(--ink); }
  .shell .master-category[open] { grid-column: 1 / -1; }
  .shell .master-category-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px; border-top: 3px solid var(--master-accent); padding: 8px; }
  .shell .master-category-links a { min-height: 44px; border: 0; }
  .shell .master-link-next { display: none; }
  .shell .master-authorized { margin-top: 32px; }
  .tms-list-filter { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
  .shell .tms-list-filter .field { margin: 0; flex: 1 1 220px; max-width: 380px; }
  .shell .tms-list-filter .field label { margin-bottom: 6px; }
  .tms-filter-check { display: flex; gap: 8px; align-items: center; min-height: 42px; font-size: 13px; }
  .tms-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
  .tms-pagination > nav { width: auto; }
  .tms-pagination svg { max-width: 20px; max-height: 20px; }
  .tms-text-action { color: var(--tms-accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
  .tms-tabbar { display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; margin-bottom: 24px; padding: 4px; border-radius: 4px; background: #edf0f6; }
  .tms-tab { display: flex; align-items: center; position: relative; min-height: 36px; padding: 8px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; color: #2b3550; }
  .tms-tab.active { background: #ffffff; color: var(--tms-accent); box-shadow: 0 1px 2px #16213e1a, 0 0 0 1px var(--line); }
  .tms-tab.active::after { content:""; position:absolute; left:12px; right:12px; bottom:2px; height:3px; border-radius:3px; background:var(--teal); }
}
@media screen and (min-width: 901px) {
  .shell.sidebar-collapsed .tms-nav-single-link { flex-direction: column; min-height: 64px; gap: 5px; padding: 7px 3px; font-size: 13px; text-align: center; }
  .shell .account { flex-wrap: nowrap; }
}
@media screen and (max-width: 1250px) {
  .shell .tms-stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tms-stat { grid-column: span 2; }
  .tms-stat:nth-child(n+4) { grid-column: span 3; }
  .tms-flow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 900px) {
  .shell .topbar { flex-wrap: nowrap; }
  .shell .topbar-leading { flex: 1 1 auto; min-width: 0; }
  .shell .account { flex: 0 0 auto; width: auto; margin-left: auto; flex-wrap: nowrap; }
  .shell .tms-menu-mode, .shell .topbar-heading { display: none; }
  .shell .tms-account-tools { display: none; }
  .shell .tms-panel-head { padding: 14px 16px; }
  .shell .tms-panel-body { padding: 16px; }
}
@media screen and (max-width: 600px) {
  .shell .tms-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tms-stat, .tms-stat:nth-child(n+4) { grid-column: auto; padding: 16px; grid-template-areas: "label icon" "value value"; gap: 10px; }
  .tms-stat-icon { width: 32px; height: 32px; border-radius: 4px; }
  .tms-stat-label { font-size: 13px; }
  .tms-stat strong { font-size: 28px; }
  .tms-flow-grid { grid-template-columns: 1fr; }
  .tms-list-filter .field { max-width: none !important; }
  .shell .tms-master-table { min-width: 680px; }
  .shell .tms-master-table td { overflow-wrap: normal; }
  .tms-tab { padding: 8px 10px; font-size: 13px; }
}
