/* Riso Press — Command Center design system (single source of truth) */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f3eee2;
  --bg-deep: #e9e1cf;
  --surface: #fbf7ec;
  --surface-1: #ece6d2;
  --surface-2: #d9d0b5;
  --line: #1a2b6d;
  --line-soft: rgba(26, 43, 109, 0.18);
  --text: #14224e;
  --text-dim: #4a5a8a;
  --text-muted: #7a85a8;
  --navy: #1a2b6d;
  --navy-deep: #0d1a4a;
  --pink: #ff5d8f;
  --pink-deep: #e63b6f;
  --rose: #c41e3a;
  --gold: #d4a500;
  --jade: #5aab9e;
  --jade-pale: #c8ebe4;
  --jade-soft: rgba(126, 196, 184, 0.16);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-pill: 999px;
  --border-width: 1.5px;
  /* legacy aliases */
  --border: var(--line);
  --border-strong: var(--navy);
  --text-2: var(--text-dim);
  --text-3: var(--text-muted);
  --accent: var(--navy);
  --accent-soft: var(--line-soft);
  --accent-medium: rgba(255, 93, 143, 0.14);
  --surface-inset: var(--surface-1);
  --green: var(--pink);
  --green-bg: rgba(255, 93, 143, 0.12);
  --green-border: var(--pink);
  --red: var(--rose);
  --red-bg: rgba(196, 30, 58, 0.1);
  --red-border: var(--rose);
  --orange: var(--gold);
  --orange-bg: rgba(212, 165, 0, 0.12);
  --orange-border: var(--gold);
  --mono: var(--font-mono);
  --sans: var(--font-sans);
  --radius: var(--radius-input);
  --radius-lg: var(--radius-card);
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
}

/* ---- HEADER ---- */
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 32px;
      height: 56px;
      background: var(--surface);
      border-bottom: var(--border-width) solid var(--border);
      
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .header-brand {
      font-family: var(--font-mono);
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      letter-spacing: -0.3px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .header-brand .mark {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      background: var(--accent);
      color: white;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: 0;
    }

    .header-right {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .header-stats {
      display: flex;
      gap: 10px;
      font-family: var(--font-mono);
      font-size: 12px;
    }

    .stat-badge {
      padding: 3px 10px;
      border-radius: 20px;
      font-weight: 500;
      letter-spacing: -0.2px;
    }

    .stat-badge.pending { background: var(--orange-bg); color: var(--orange); border: var(--border-width) solid var(--orange-border); }
    .stat-badge.executed { background: var(--green-bg); color: var(--green); border: var(--border-width) solid var(--green-border); }
    .stat-badge.failed { background: var(--red-bg); color: var(--red); border: var(--border-width) solid var(--red-border); }

    .header-user {
      display: flex;
      align-items: center;
      gap: 10px;
      padding-left: 16px;
      border-left: var(--border-width) solid var(--border);
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--text-3);
    }

    .btn-logout {
      padding: 4px 10px;
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      background: var(--surface);
      color: var(--text-3);
      font-family: var(--font-mono);
      font-size: 11px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-logout:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

    /* ---- LOGIN ---- */
    .login-screen {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      background: var(--bg);
    }

    .login-box {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 36px 32px;
      width: 380px;
      
    }

    .login-brand {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 6px;
    }

    .login-brand .mark {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      background: var(--accent);
      color: white;
      border-radius: 8px;
      font-family: var(--font-mono);
      font-size: 15px;
      font-weight: 600;
    }

    .login-brand h2 {
      font-family: var(--font-mono);
      font-size: 17px;
      font-weight: 600;
      color: var(--text);
      letter-spacing: -0.3px;
    }

    .login-box > p {
      color: var(--text-3);
      font-size: 13px;
      margin-bottom: 24px;
      margin-top: 4px;
    }

    .login-box .form-group { margin-bottom: 14px; }

    .login-box .form-group label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      margin-bottom: 5px;
      color: var(--text-2);
      font-family: var(--font-mono);
    }

    .login-box .form-group input {
      width: 100%;
      padding: 9px 12px;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 14px;
      transition: border-color 0.15s;
    }

    .login-box .form-group input:focus {
      outline: none;
      border-color: var(--accent);
      
    }

    .login-error {
      font-size: 13px;
      color: var(--red);
      margin-bottom: 10px;
      padding: 8px 10px;
      background: var(--red-bg);
      border-radius: var(--radius);
      display: none;
    }

    .btn-login {
      width: 100%;
      padding: 10px;
      background: var(--accent);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-family: var(--font-sans);
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-login:hover { opacity: 0.9; }
    .btn-login:disabled { opacity: 0.4; cursor: not-allowed; }

    .login-toggle {
      text-align: center;
      margin-top: 16px;
      font-size: 13px;
      color: var(--text-3);
    }

    .login-toggle a {
      color: var(--accent);
      cursor: pointer;
      text-decoration: none;
      font-weight: 500;
    }

    .login-toggle a:hover { text-decoration: underline; }

    /* ---- LAYOUT ---- */
    .container { max-width: 960px; margin: 0 auto; padding: 24px 24px; }

    /* ---- TABS ---- */
    .tabs {
      display: flex;
      gap: 2px;
      margin-bottom: 20px;
      border-bottom: var(--border-width) solid var(--border);
      padding-bottom: 0;
    }

    .tab {
      padding: 10px 16px;
      border: none;
      background: transparent;
      color: var(--text-3);
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
      transition: all 0.15s;
    }

    .tab:hover { color: var(--text-2); }

    .tab.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    .tab-count {
      font-family: var(--font-mono);
      font-size: 11px;
      margin-left: 5px;
      padding: 1px 6px;
      border-radius: 10px;
      background: var(--surface-inset);
      color: var(--text-3);
    }

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

    /* ---- TASK CARDS ---- */
    .task-list { display: flex; flex-direction: column; gap: 10px; }

    .task-card {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 18px 20px;
      transition: box-shadow 0.15s, border-color 0.15s;
      
    }

    .task-card:hover { border-color: var(--border-strong);  }

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

    .task-type {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      padding: 3px 8px;
      border-radius: 4px;
      background: var(--accent-soft);
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .task-priority {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      padding: 3px 8px;
      border-radius: 4px;
    }

    .priority-urgent { background: var(--red-bg); color: var(--red); border: var(--border-width) solid var(--red-border); }
    .priority-high { background: var(--orange-bg); color: var(--orange); border: var(--border-width) solid var(--orange-border); }
    .priority-normal { background: var(--surface-inset); color: var(--text-3); }
    .priority-low { background: var(--surface-inset); color: var(--text-3); opacity: 0.65; }

    .task-recipients {
      font-size: 14px;
      font-weight: 600;
      margin-bottom: 6px;
      color: var(--text);
    }

    .task-subject {
      font-size: 13px;
      color: var(--accent);
      margin-bottom: 8px;
      font-weight: 500;
    }

    .task-body {
      font-size: 13px;
      color: var(--text-2);
      line-height: 1.6;
      margin-bottom: 10px;
      white-space: pre-wrap;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      padding: 10px 12px;
      border-radius: var(--radius);
      max-height: 120px;
      overflow-y: auto;
    }

    .task-body-edit-wrap { position: relative; }
    .task-body-editor {
      font-size: 13px;
      font-family: inherit;
      color: var(--text-1);
      line-height: 1.6;
      margin-bottom: 10px;
      white-space: pre-wrap;
      background: var(--surface-2);
      border: var(--border-width) solid var(--green);
      padding: 10px 12px;
      border-radius: var(--radius);
      min-height: 60px;
      max-height: 200px;
      width: 100%;
      resize: vertical;
      box-sizing: border-box;
    }
    .btn-edit-toggle {
      position: absolute;
      top: 4px;
      right: 4px;
      z-index: 2;   /* .task-card .task-body sits at z-index 1 and would cover the button */
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      color: var(--text-2);
      font-size: 11px;
      padding: 2px 8px;
      border-radius: var(--radius);
      cursor: pointer;
    }
    .btn-edit-toggle:hover { border-color: var(--green); color: var(--green); }

    .task-context {
      font-size: 12px;
      color: var(--text-2);
      padding: 8px 12px;
      border-left: var(--border-width) solid var(--accent);
      margin-bottom: 10px;
      background: var(--accent-soft);
      border-radius: 0 var(--radius) var(--radius) 0;
    }

    .task-context label {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      color: var(--accent);
      display: block;
      margin-bottom: 3px;
    }

    .task-summary {
      font-size: 12px;
      color: var(--text-2);
      padding: 8px 12px;
      border-left: var(--border-width) solid var(--green);
      margin-bottom: 10px;
      background: var(--green-bg);
      border-radius: 0 var(--radius) var(--radius) 0;
    }

    .task-summary label {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      color: var(--green);
      display: block;
      margin-bottom: 3px;
    }

    .task-ref-link {
      display: inline-block;
      font-size: 12px;
      color: var(--accent);
      text-decoration: none;
      margin-bottom: 10px;
      font-family: var(--font-mono);
      font-weight: 500;
    }

    .task-ref-link:hover { text-decoration: underline; }

    .task-error {
      font-size: 12px;
      color: var(--red);
      padding: 8px 12px;
      border-left: var(--border-width) solid var(--red);
      margin-bottom: 10px;
      background: var(--red-bg);
      border-radius: 0 var(--radius) var(--radius) 0;
    }

    .task-error label {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      color: var(--red);
      display: block;
      margin-bottom: 3px;
    }

    .task-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 2px;
    }

    .task-time {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-3);
    }

    .task-reply-all-wrap {
      margin-bottom: 6px;
    }
    .btn-reply-all-toggle {
      background: none;
      border: none;
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--accent);
      cursor: pointer;
      padding: 2px 0;
      font-weight: 500;
    }
    .btn-reply-all-toggle:hover { text-decoration: underline; }
    .task-reply-all-list {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 4px;
      padding: 6px 8px;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
    }
    .reply-all-email {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-2);
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: 3px;
      padding: 2px 6px;
    }
    .btn-reply-all {
      background: var(--accent);
    }

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

    .btn {
      padding: 7px 16px;
      border: none;
      border-radius: var(--radius);
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-approve {
      background: var(--green);
      color: white;
    }

    .btn-approve:hover { opacity: 0.9; }

    .btn-reject {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      color: var(--text-2);
    }

    .btn-reject:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

    .btn-small {
      padding: 4px 12px;
      font-size: 12px;
    }

    /* ---- STATUS BADGES ---- */
    .status-badge {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      padding: 3px 8px;
      border-radius: 4px;
    }

    .status-executed { background: var(--green-bg); color: var(--green); }
    .status-rejected { background: var(--red-bg); color: var(--red); }
    .status-failed { background: var(--red-bg); color: var(--red); }
    .status-approved { background: var(--orange-bg); color: var(--orange); }

    .review-banner {
      background: rgba(212, 165, 0, 0.15);
      border: var(--border-width) solid #665200;
      border-radius: 6px;
      padding: 8px 12px;
      margin: 8px 0;
      font-size: 12px;
      color: var(--gold);
      line-height: 1.4;
    }
    .review-banner label {
      font-weight: 600;
      display: block;
      margin-bottom: 2px;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .approval-badge {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 500;
      padding: 2px 7px;
      border-radius: 4px;
      background: var(--accent-soft);
      color: var(--accent);
      margin-left: 6px;
    }

    /* ---- RULES ---- */
    .rule-card {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 14px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
      
    }

    .rule-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 3px; color: var(--text); }

    .rule-info p {
      font-size: 12px;
      color: var(--text-3);
      font-family: var(--font-mono);
    }

    .rule-toggle {
      width: 38px; height: 22px;
      border-radius: 11px;
      background: var(--border);
      border: none;
      cursor: pointer;
      position: relative;
      transition: background 0.2s;
    }

    .rule-toggle.active { background: var(--green); }

    .rule-toggle::after {
      content: '';
      position: absolute;
      width: 16px; height: 16px;
      border-radius: 50%;
      background: white;
      top: 3px; left: 3px;
      transition: transform 0.2s;
      
    }

    .rule-toggle.active::after { transform: translateX(16px); }

    /* ---- FORMS ---- */
    .add-rule-form {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 18px 20px;
      margin-bottom: 14px;
      display: none;
      
    }

    .add-rule-form.show { display: block; }

    .form-row { display: flex; gap: 12px; margin-bottom: 12px; }

    .form-group { flex: 1; }

    .form-group label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      margin-bottom: 4px;
      color: var(--text-2);
      font-family: var(--font-mono);
    }

    .form-group input, .form-group select, .form-group textarea {
      width: 100%;
      padding: 8px 10px;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 13px;
      transition: border-color 0.15s;
    }

    .form-group textarea {
      resize: vertical;
      min-height: 60px;
      line-height: 1.5;
    }

    .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
      outline: none;
      border-color: var(--accent);
      
    }

    /* ---- CREATE TASK ---- */
    .create-task-bar {
      display: flex;
      justify-content: flex-end;
      margin-bottom: 14px;
    }

    .btn-create {
      padding: 7px 16px;
      border: var(--border-width) solid var(--accent);
      border-radius: var(--radius);
      background: var(--accent-soft);
      color: var(--accent);
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-create:hover { background: var(--accent); color: white; }

    .create-task-form {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 20px;
      margin-bottom: 16px;
      display: none;
      
    }

    .create-task-form.show { display: block; }

    .create-task-form h3 {
      font-size: 14px;
      font-weight: 600;
      margin-bottom: 14px;
      color: var(--text);
    }

    /* ---- STATES ---- */
    .empty-state {
      text-align: center;
      padding: 56px 20px;
      color: var(--text-3);
    }

    .empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
    .empty-state p { font-size: 13px; }

    .loading {
      text-align: center;
      padding: 40px;
      color: var(--text-3);
      font-family: var(--font-mono);
      font-size: 13px;
    }

    .hidden { display: none !important; }

    /* ---- ANIMATIONS ---- */
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .task-card { animation: fadeIn 0.25s ease both; }
    .task-card:nth-child(2) { animation-delay: 0.03s; }
    .task-card:nth-child(3) { animation-delay: 0.06s; }
    .task-card:nth-child(4) { animation-delay: 0.09s; }
    .task-card:nth-child(5) { animation-delay: 0.12s; }

    .rule-card { animation: fadeIn 0.2s ease both; }

    /* ---- FEED ---- */
    .feed-status-bar {
      display: flex;
      gap: 16px;
      align-items: center;
      padding: 10px 16px;
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      margin-bottom: 14px;
      
      font-size: 12px;
      font-family: var(--font-mono);
      color: var(--text-3);
      flex-wrap: wrap;
    }

    .poller-status {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .poller-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      display: inline-block;
    }

    .poller-dot.ok { background: var(--green); }
    .poller-dot.error { background: var(--red); }
    .poller-dot.unknown { background: var(--border-strong); }

    .feed-filters {
      display: flex;
      gap: 6px;
      margin-bottom: 14px;
    }

    .feed-filter-btn {
      padding: 5px 14px;
      border: var(--border-width) solid var(--border);
      border-radius: 20px;
      background: var(--surface);
      color: var(--text-3);
      font-family: var(--font-sans);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s;
    }

    .feed-filter-btn:hover { border-color: var(--border-strong); color: var(--text-2); }

    .feed-filter-btn.active {
      background: var(--accent-soft);
      border-color: var(--accent);
      color: var(--accent);
    }

    .feed-card {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 16px 18px;
      margin-bottom: 8px;
      
      transition: box-shadow 0.15s, border-color 0.15s;
      animation: fadeIn 0.25s ease both;
    }

    .feed-card:hover { border-color: var(--border-strong);  }

    .feed-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }

    .feed-card-header-left {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .source-badge {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .source-badge.gmail { background: rgba(196, 30, 58, 0.12); color: var(--rose); border: var(--border-width) solid var(--rose); }
    .source-badge.google_chat { background: var(--line-soft); color: var(--navy); border: var(--border-width) solid var(--navy); }

    .feed-indicators {
      display: flex;
      gap: 5px;
    }

    .feed-indicator {
      font-family: var(--font-mono);
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 3px;
      background: var(--surface-inset);
      color: var(--text-3);
    }

    .feed-from {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 3px;
    }

    .feed-subject {
      font-size: 13px;
      color: var(--accent);
      font-weight: 500;
      margin-bottom: 6px;
    }

    .feed-body-preview {
      font-size: 13px;
      color: var(--text-2);
      line-height: 1.5;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      padding: 8px 12px;
      border-radius: var(--radius);
      max-height: 80px;
      overflow: hidden;
      margin-bottom: 8px;
    }

    .feed-card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .feed-time {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-3);
    }

    .feed-labels {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
    }

    .feed-label {
      font-family: var(--font-mono);
      font-size: 10px;
      padding: 1px 5px;
      border-radius: 3px;
      background: var(--surface-inset);
      color: var(--text-3);
    }

    .feed-top-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .feed-top-bar .feed-filters { margin-bottom: 0; }

    .feed-settings-panel {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 20px;
      margin-bottom: 16px;
      display: flex;
      gap: 32px;
    }

    .feed-settings-section { flex: 1; }

    .feed-settings-section h4 {
      font-family: var(--font-mono);
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-2);
      margin: 0 0 4px;
    }

    .feed-settings-desc {
      font-size: 12px;
      color: var(--text-3);
      margin: 0 0 10px;
    }

    .feed-settings-add {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
    }

    .feed-settings-add .form-input { flex: 1; }

    .blocklist-items { display: flex; flex-direction: column; gap: 6px; }

    .blocklist-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface-inset);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      padding: 6px 10px;
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--text);
    }

    .blocklist-item-remove {
      background: none;
      border: none;
      color: var(--text-3);
      cursor: pointer;
      font-size: 14px;
      padding: 0 2px;
      line-height: 1;
    }

    .blocklist-item-remove:hover { color: var(--red); }

    .blocklist-empty {
      font-size: 12px;
      color: var(--text-3);
      font-style: italic;
    }

    .pagination {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 16px 0 8px;
    }

    .pagination-info {
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--text-3);
      min-width: 120px;
      text-align: center;
    }

    .tab-badge {
      font-family: var(--font-mono);
      font-size: 10px;
      min-width: 16px;
      height: 16px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      background: var(--red);
      color: white;
      margin-left: 5px;
      padding: 0 4px;
    }

    .tab-badge.zero { display: none; }

    /* ---- ESCALATIONS ---- */
    .escalation-panel { padding: 0; }

    .escalation-filter-bar {
      display: flex;
      gap: 8px;
      padding: 16px 0 12px;
      align-items: center;
    }

    .escalation-filter-btn {
      padding: 4px 12px;
      border-radius: 20px;
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      border: var(--border-width) solid var(--border);
      background: var(--surface);
      color: var(--text-3);
      cursor: pointer;
      transition: all 0.15s;
    }

    .escalation-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
    .escalation-filter-btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: white;
    }

    .escalation-list { display: flex; flex-direction: column; gap: 8px; }

    .escalation-card {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .escalation-card.active { border-left: var(--border-width) solid var(--red); }
    .escalation-card.acknowledged { border-left: var(--border-width) solid var(--border-strong); opacity: 0.7; }

    .escalation-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .escalation-type-badge {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .escalation-type-badge.alert { background: var(--red-bg); color: var(--red); border: var(--border-width) solid var(--red-border); }
    .escalation-type-badge.eta { background: var(--orange-bg); color: var(--orange); border: var(--border-width) solid var(--orange-border); }

    .escalation-service {
      font-family: var(--font-mono);
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
    }

    .escalation-time {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-3);
      margin-left: auto;
    }

    .escalation-message {
      font-size: 13px;
      color: var(--text-2);
      line-height: 1.5;
    }

    .escalation-footer {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 4px;
    }

    .escalation-meta {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-3);
    }

    .escalation-actions { display: flex; gap: 6px; margin-left: auto; }

    .btn-acknowledge {
      padding: 4px 12px;
      border: var(--border-width) solid var(--green-border);
      border-radius: var(--radius);
      background: var(--green-bg);
      color: var(--green);
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-acknowledge:hover { background: var(--green); color: white; }

    .btn-delete-esc {
      padding: 4px 10px;
      border: var(--border-width) solid var(--red-border);
      border-radius: var(--radius);
      background: var(--red-bg);
      color: var(--red);
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-delete-esc:hover { background: var(--red); color: white; }

    .escalation-empty {
      text-align: center;
      padding: 48px 24px;
      color: var(--text-3);
      font-family: var(--font-mono);
      font-size: 13px;
    }

    /* ---- KANBAN ---- */
    .kanban-board {
      display: flex;
      gap: 12px;
      overflow-x: auto;
      padding-bottom: 12px;
      align-items: flex-start;
    }

    .kanban-col {
      flex: 1;
      min-width: 200px;
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      display: flex;
      flex-direction: column;
      max-height: calc(100vh - 200px);
      
    }

    .kanban-col-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 11px 14px 9px;
      border-bottom: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      background: var(--surface);
      position: sticky;
      top: 0;
      z-index: 1;
    }

    .kanban-col-title {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-3);
    }
    .kanban-col-title.stage-TODO       { color: var(--text-3); }
    .kanban-col-title.stage-IN_PROGRESS{ color: var(--accent); }
    .kanban-col-title.stage-BLOCKED    { color: var(--red); }
    .kanban-col-title.stage-DONE       { color: var(--green); }

    .kanban-col-count {
      font-family: var(--font-mono);
      font-size: 11px;
      padding: 1px 7px;
      border-radius: 10px;
      background: var(--surface-inset);
      color: var(--text-3);
      font-weight: 500;
    }

    .kanban-col[data-stage="IN_PROGRESS"] .kanban-col-header {
      border-top: var(--border-width) solid var(--accent);
    }
    .kanban-col[data-stage="BLOCKED"] .kanban-col-header {
      border-top: var(--border-width) solid var(--red);
    }
    .kanban-col[data-stage="DONE"] .kanban-col-header {
      border-top: var(--border-width) solid var(--green);
    }

    .kanban-quick-add {
      padding: 8px 10px;
      border-bottom: var(--border-width) solid var(--border);
    }

    .kanban-quick-input {
      width: 100%;
      padding: 7px 10px;
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 13px;
      transition: border-color 0.15s;
    }
    .kanban-quick-input:focus {
      outline: none;
      border-color: var(--accent);
      
    }
    .kanban-quick-input::placeholder { color: var(--text-3); }

    .kanban-cards {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-height: 80px;
      transition: background 0.15s;
    }

    .kanban-cards.drag-over {
      background: var(--accent-soft);
      border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    .kanban-card {
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      padding: 10px 11px;
      cursor: grab;
      transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
      user-select: none;
      animation: fadeIn 0.2s ease both;
    }
    .kanban-card:hover { border-color: var(--border-strong);  }
    .kanban-card.dragging { opacity: 0.35; cursor: grabbing; }

    .kanban-card-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 6px;
      margin-bottom: 6px;
    }

    .kanban-card-title {
      font-size: 13px;
      font-weight: 500;
      color: var(--text);
      line-height: 1.4;
      flex: 1;
      word-break: break-word;
      cursor: text;
      border-radius: 3px;
      padding: 1px 3px;
      margin: -1px -3px;
    }
    .kanban-card-title:focus {
      outline: none;
      background: var(--surface);
      
    }

    .kanban-card-delete {
      background: none;
      border: none;
      color: var(--text-3);
      cursor: pointer;
      font-size: 13px;
      padding: 0;
      line-height: 1;
      opacity: 0;
      transition: opacity 0.12s, color 0.12s;
      flex-shrink: 0;
      margin-top: 1px;
    }
    .kanban-card:hover .kanban-card-delete { opacity: 1; }
    .kanban-card-delete:hover { color: var(--red); }

    .kanban-card-desc {
      font-size: 12px;
      color: var(--text-3);
      line-height: 1.4;
      margin-bottom: 7px;
      white-space: pre-wrap;
    }

    .kanban-card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .kanban-card-time {
      font-family: var(--font-mono);
      font-size: 10px;
      color: var(--text-3);
    }

    /* ---- KANBAN SEND MODAL ---- */
    .km-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.55);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }
    .km-modal {
      background: var(--surface);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 560px;
      max-height: 85vh;
      display: flex;
      flex-direction: column;
      
    }
    .km-header {
      padding: 16px 18px 12px;
      border-bottom: var(--border-width) solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .km-header h3 { font-size: 14px; font-weight: 600; margin: 0; }
    .km-close {
      background: none;
      border: none;
      color: var(--text-3);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      padding: 2px 4px;
    }
    .km-close:hover { color: var(--text); }
    .km-body {
      overflow-y: auto;
      padding: 16px 18px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .km-context-block {
      background: var(--surface-inset);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .km-context-block label {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-3);
      font-family: var(--font-mono);
    }
    .km-context-row { display: flex; flex-direction: column; gap: 2px; }
    .km-context-value {
      font-size: 12px;
      color: var(--text-2);
      white-space: pre-wrap;
      word-break: break-word;
      max-height: 100px;
      overflow-y: auto;
    }
    .km-context-value a { color: var(--accent); }
    .km-field { display: flex; flex-direction: column; gap: 5px; }
    .km-field label { font-size: 11px; font-weight: 500; color: var(--text-2); }
    .km-field input, .km-field select {
      background: var(--surface-2);
      border: var(--border-width) solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 13px;
      padding: 7px 10px;
      width: 100%;
    }
    .km-field input:focus, .km-field select:focus {
      outline: none;
      border-color: var(--accent);
      
    }
    .km-row { display: flex; gap: 10px; }
    .km-row .km-field { flex: 1; }
    .km-footer {
      padding: 12px 18px;
      border-top: var(--border-width) solid var(--border);
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }
  

        .reports-tree { padding: 16px 0; }
        .reports-tree-empty { padding: 24px; color: var(--text-3); text-align: center; }
        .reports-year { margin-bottom: 12px; }
        .reports-year-header, .reports-month-header, .reports-date-header {
          cursor: pointer; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
          border-radius: var(--radius); display: flex; align-items: center; gap: 10px;
          font-family: var(--sans); font-weight: 500; user-select: none;
        }
        .reports-year-header { font-size: 16px; }
        .reports-month-header { font-size: 14px; background: var(--surface-2); }
        .reports-date-header { font-size: 13px; background: var(--surface-2); padding: 8px 12px; }
        .reports-year-header:hover, .reports-month-header:hover, .reports-date-header:hover { background: var(--accent-soft); }
        .reports-children { padding-left: 20px; margin-top: 6px; }
        .reports-caret { font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 12px; }
        .reports-count { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: auto; }
        .reports-entry {
          padding: 10px 14px; cursor: pointer; border-radius: var(--radius); display: flex;
          align-items: center; gap: 10px; margin: 4px 0; background: var(--surface); border: 1px solid var(--border);
        }
        .reports-entry:hover { background: var(--accent-soft); border-color: var(--accent); }
        .reports-entry-type {
          font-family: var(--mono); font-size: 11px; padding: 2px 8px; background: var(--accent-soft);
          color: var(--accent); border-radius: 3px; text-transform: uppercase; letter-spacing: 0.3px;
        }
        .reports-entry-title { flex: 1; font-size: 14px; color: var(--text); }
        .reports-entry-summary { font-size: 12px; color: var(--text-3); margin-left: 8px; }
        .reports-viewer { display: flex; flex-direction: column; height: calc(100vh - 130px); }
        .reports-viewer-header {
          display: flex; align-items: center; gap: 14px; padding: 12px 16px;
          background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
          margin-bottom: 8px;
        }
        .reports-viewer-title { flex: 1; font-weight: 600; }
        .reports-viewer iframe { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: white; }
        .reports-back-btn {
          padding: 6px 12px; font-size: 13px; cursor: pointer; background: var(--surface-2);
          border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--sans);
        }
        .reports-back-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
      

/* ---- Riso Press base ---- */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2.page-title, .login-brand h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2.page-title, .login-brand h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); }

a:hover, .tab:hover, .task-ref-link:hover, .btn-reply-all-toggle:hover {
  text-decoration: none;
  text-decoration-line: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

/* Card chrome — task lists use soft jade offset (readable); others keep pink accent */
.task-card, .rule-card, .feed-card, .login-box, .add-rule-form, .create-task-form,
.feed-status-bar, .kanban-col, .escalation-card, .km-modal, .reports-entry,
.reports-year-header, .reports-month-header, .reports-date-header {
  position: relative;
  background: var(--surface);
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: none;
}

.task-card {
  isolation: isolate;
  z-index: 0;
}

/* Task queue cards: pale jade offset — not pink (legibility for dates/summary) */
.task-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--jade-pale);
  opacity: 0.55;
  transform: translate(3px, 3px);
  z-index: -1;
}

.rule-card::before, .feed-card::before, .login-box::before,
.add-rule-form::before, .create-task-form::before, .feed-status-bar::before,
.kanban-col::before, .escalation-card::before, .km-modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--pink);
  transform: translate(4px, 4px);
  z-index: -1;
}

.task-card:hover, .feed-card:hover, .rule-card:hover {
  border-color: var(--navy);
  box-shadow: none;
}

.task-card .task-time,
.task-card .task-footer,
.task-card .task-recipients,
.task-card .task-body,
.task-card .task-subject {
  position: relative;
  z-index: 1;
}

.task-card .task-time {
  color: var(--text-dim);
  font-weight: 500;
}

/* Task action UX — in-place loading, smooth dismiss (no full-list flash) */
.task-list {
  transition: gap 0.3s ease;
}

.task-card {
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    max-height 0.32s ease,
    margin-bottom 0.32s ease,
    padding 0.32s ease,
    border-width 0.2s ease,
    border-color 0.15s;
  overflow: hidden;
}

.task-card--busy {
  opacity: 0.88;
  pointer-events: none;
}

.task-card--busy .task-actions .btn.is-loading {
  pointer-events: none;
  cursor: wait;
  opacity: 1;
}

.task-card--exit {
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  max-height: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
}

.task-card--exit::before {
  opacity: 0;
}

.btn.is-loading {
  cursor: wait;
  min-width: 6.5em;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Header = editorial masthead */
.header {
  background: var(--bg-deep);
  border-bottom: var(--border-width) solid var(--line);
  box-shadow: none;
  height: 64px;
}

.header-brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.header-brand .mark {
  background: var(--navy);
  color: var(--bg);
  border-radius: var(--radius-card);
  border: var(--border-width) solid var(--line);
  font-family: var(--font-mono);
}

/* Tabs */
.tabs { border-bottom: var(--border-width) solid var(--line); margin-bottom: 24px; gap: 4px; }
.tab {
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  font-weight: 600;
}
.tab.active {
  color: var(--navy);
  border-bottom: 3px solid var(--pink);
  background: var(--surface);
}
.tab.active .tab-count { background: rgba(255, 93, 143, 0.15); color: var(--pink-deep); }

/* Buttons */
.btn, .btn-login, .btn-create, .btn-approve, .btn-reject, .btn-logout,
.btn-acknowledge, .btn-delete-esc, .feed-filter-btn, .escalation-filter-btn,
.reports-back-btn, .btn-secondary {
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: var(--border-width) solid var(--line);
  box-shadow: none;
}

.btn-approve, .btn-login, .btn-create:hover, .escalation-filter-btn.active {
  background: var(--navy);
  color: var(--bg);
  border-color: var(--line);
}

.btn-reject, .btn-secondary, .btn-logout, .btn-create, .feed-filter-btn {
  background: var(--bg);
  color: var(--navy);
}

.btn-reject:hover, .btn-secondary:hover, .btn-logout:hover, .feed-filter-btn:hover {
  background: var(--pink);
  color: var(--bg);
  border-color: var(--line);
}

.btn-create {
  background: var(--bg);
  color: var(--navy);
  border-color: var(--line);
}
.btn-create:hover { background: var(--pink); color: var(--bg); }

/* Pills / badges */
.stat-badge, .status-badge, .task-type, .task-priority, .source-badge,
.approval-badge, .escalation-type-badge, .tab-count, .kanban-col-count {
  border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--line);
  font-weight: 700;
}

.stat-badge.pending, .status-approved, .escalation-type-badge.eta {
  background: rgba(212, 165, 0, 0.12);
  color: var(--gold);
  border-color: var(--gold);
}
.stat-badge.executed, .status-executed, .priority-normal {
  background: rgba(255, 93, 143, 0.12);
  color: var(--pink-deep);
  border-color: var(--pink);
}
.stat-badge.failed, .status-failed, .status-rejected, .priority-urgent,
.escalation-type-badge.alert {
  background: rgba(196, 30, 58, 0.1);
  color: var(--rose);
  border-color: var(--rose);
}
.priority-high {
  background: rgba(212, 165, 0, 0.12);
  color: var(--gold);
  border-color: var(--gold);
}

.task-type, .tab.active .tab-count, .feed-filter-btn.active, .approval-badge {
  background: rgba(255, 93, 143, 0.12);
  color: var(--navy);
  border-color: var(--navy);
}

/* Forms / inputs */
.form-group input, .form-group select, .form-group textarea,
.login-box .form-group input, .kanban-quick-input, .km-field input, .km-field select {
  background: var(--bg);
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-input);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.login-box .form-group input:focus, .kanban-quick-input:focus, .km-field input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 4px 4px 0 var(--pink);
}

/* Context blocks */
.task-context, .task-summary, .task-error {
  border-left: var(--border-width) solid var(--line);
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
  background: var(--surface-1);
}
.task-context { border-left-color: var(--navy); }
.task-context label { color: var(--navy); }
.task-summary { border-left-color: var(--jade); background: var(--jade-soft); }
.task-summary label { color: var(--jade); }
.task-error { border-left-color: var(--rose); }

.task-card .task-subject { color: var(--navy); font-weight: 600; }
.feed-subject { color: var(--pink-deep); }

/* Tables / lists hover */
.task-body, .feed-body-preview, .task-reply-all-list {
  border: var(--border-width) solid var(--line);
  background: var(--bg);
}

/* Kanban */
.kanban-col-header { background: var(--bg-deep); }
.kanban-col[data-stage="IN_PROGRESS"] .kanban-col-header { border-top: var(--border-width) solid var(--pink); }
.kanban-col[data-stage="BLOCKED"] .kanban-col-header { border-top: var(--border-width) solid var(--rose); }
.kanban-col[data-stage="DONE"] .kanban-col-header { border-top: var(--border-width) solid var(--navy); }
.kanban-col-title.stage-IN_PROGRESS { color: var(--pink-deep); }
.kanban-col-title.stage-BLOCKED { color: var(--rose); }
.kanban-col-title.stage-DONE { color: var(--navy); }
.kanban-cards.drag-over { background: rgba(255, 93, 143, 0.06); }
.kanban-card:hover { background: rgba(255, 93, 143, 0.06); border-color: var(--line); }

/* Modal overlay */
.km-overlay { background: rgba(20, 34, 78, 0.45); }

/* Poller dots */
.poller-dot.ok { background: var(--pink); }
.poller-dot.error { background: var(--rose); }
.poller-dot.unknown { background: var(--surface-2); border: var(--border-width) solid var(--line); }

/* Section divider utility */
.riso-divider {
  display: block;
  width: 100%;
  height: 12px;
  margin: 24px 0;
  border: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 12'%3E%3Cpath d='M0 6 Q150 0 300 6 T600 6 T900 6 T1200 6' fill='none' stroke='%231a2b6d' stroke-width='1.5'/%3E%3C/svg%3E") repeat-x center;
  opacity: 0.5;
}

.container { padding: 24px; max-width: 1040px; }
body.wide-layout .container { max-width: none; }

/* Gmail-style undo toast */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--navy);
  color: var(--cream);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-family: var(--font-sans);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 9999;
  min-width: 200px;
  overflow: hidden;
  animation: undoToastIn 0.2s ease;
}
.undo-toast--out { animation: undoToastOut 0.2s ease forwards; }
.undo-toast-msg { flex: 1; }
.undo-toast-btn {
  background: none;
  border: 1px solid var(--pink);
  color: var(--pink);
  border-radius: var(--radius);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.undo-toast-btn:hover { background: var(--pink); color: var(--bg); }
.undo-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  animation: undoBarShrink 3s linear forwards;
}
@keyframes undoToastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes undoToastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(12px); }
}
@keyframes undoBarShrink {
  from { width: 100%; }
  to   { width: 0%; }
}

/* Reports (merged) */

/* ===================== Security tab ===================== */
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 8px 0 16px; }
.sec-title { font-family: var(--font-serif); font-weight: 400; font-size: 30px; color: var(--navy); margin: 0; }
.sec-sub { color: var(--text-dim); margin: 4px 0 0; max-width: 62ch; font-size: 13px; }
.sec-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.sec-kpi { background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--radius-card);
  padding: 8px 14px; min-width: 104px; display: flex; flex-direction: column; }
.sec-kpi b { font-family: var(--font-serif); font-weight: 400; font-size: 26px; line-height: 1.1; color: var(--navy);
  font-variant-numeric: tabular-nums; }
.sec-kpi span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.sec-kpi.crit { border-color: var(--rose); }
.sec-kpi.crit b { color: var(--rose); }
.sec-kpi.quiet b { color: var(--text-dim); }

.sec-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.sec-seg { display: inline-flex; border: var(--border-width) solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.sec-seg button { background: var(--bg); color: var(--navy); border: 0; padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer; }
.sec-seg button + button { border-left: var(--border-width) solid var(--line-soft); }
.sec-seg button.active { background: var(--navy); color: var(--bg); }
.sec-seg button:focus-visible, .sec-chip:focus-visible, .sec-link:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.sec-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; }
.sec-search { flex: 1 1 220px; min-width: 180px; padding: 7px 12px; border: var(--border-width) solid var(--line);
  border-radius: var(--radius-input); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.sec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sec-chip { background: var(--surface); color: var(--navy); border: var(--border-width) solid var(--line-soft);
  border-radius: var(--radius-pill); padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.sec-chip span { color: var(--text-muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.sec-chip.active { border-color: var(--pink); background: rgba(255, 93, 143, 0.12); color: var(--pink-deep); }

.sec-list { display: flex; flex-direction: column; gap: 10px; }
.sec-empty { color: var(--text-dim); padding: 24px; text-align: center; }
.sec-card { position: relative; background: var(--surface); border: var(--border-width) solid var(--line);
  border-left-width: 6px; border-radius: var(--radius-card); padding: 12px 16px; }
.sec-card.sev-critical { border-left-color: var(--rose); }
.sec-card.sev-high { border-left-color: var(--pink); }
.sec-card.sev-medium { border-left-color: var(--gold); }
.sec-card.sev-low, .sec-card.sev-unknown { border-left-color: var(--line-soft); }
.sec-card.closed { opacity: .72; }
.sec-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sec-sev, .sec-kev, .sec-prod, .sec-pill { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  border-radius: var(--radius-pill); padding: 2px 9px; border: var(--border-width) solid var(--line-soft); color: var(--text-dim); }
.sec-sev.critical { background: var(--rose); border-color: var(--rose); color: var(--surface); }
.sec-sev.high { color: var(--pink-deep); border-color: var(--pink); }
.sec-sev.medium { color: var(--gold); border-color: var(--gold); }
.sec-kev { background: var(--navy); border-color: var(--navy); color: var(--bg); }
.sec-kev.confirmed { background: var(--rose); border-color: var(--rose); color: var(--surface); }
.sec-kev.verify { background: transparent; border-style: dashed; border-color: var(--line); color: var(--text-dim); }
.sec-prod { color: var(--navy); border-color: var(--line); }
.sec-pill.review { color: var(--gold); border-color: var(--gold); }
.sec-pill.closed { color: var(--jade); border-color: var(--jade); }
.sec-pill.zw { color: var(--navy); border-color: var(--navy); text-decoration: none; }
.sec-pill.zw.needs { color: var(--rose); border-color: var(--rose); }
.sec-pill.kev-mini { color: var(--navy); border-color: var(--navy); }
.sec-dates { margin-left: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sec-card-title { font-size: 15px; font-weight: 700; margin: 8px 0 4px; line-height: 1.35; text-wrap: balance; }
.sec-card-title a { color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.sec-card-title a:hover { border-bottom-color: var(--pink); }
.sec-meta { font-size: 13px; color: var(--text-dim); }
.sec-meta a { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }
.sec-do { margin-top: 8px; font-size: 13px; color: var(--text); background: var(--jade-soft); border-radius: var(--radius-input);
  padding: 7px 10px; max-width: 110ch; }
.sec-do span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--jade); margin-right: 8px; }
.sec-note { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); }
.sec-note.warn { color: var(--rose); font-weight: 600; }
.sec-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.sec-link { background: none; border: 0; color: var(--navy); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0;
  text-decoration: underline; text-decoration-color: var(--line-soft); text-underline-offset: 3px; }
.sec-actions { display: flex; gap: 8px; }
.sec-btn { padding: 6px 16px; font-size: 13px; }
.sec-btn[disabled] { opacity: .6; cursor: progress; }
.sec-detail { margin-top: 10px; border-top: 1px dashed var(--line-soft); padding-top: 10px; font-size: 13px; }
.sec-desc { color: var(--text-dim); max-width: 110ch; white-space: pre-line; }
.sec-table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.sec-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.sec-table th { position: sticky; top: 0; background: var(--navy); color: var(--bg); text-align: left; padding: 6px 8px; font-weight: 600; }
.sec-table td { border-bottom: 1px solid var(--line-soft); padding: 5px 8px; vertical-align: top; }
.sec-more { text-align: center; margin: 16px 0 30px; }

/* Security: upgrade plan view */
.sec-view { margin-bottom: 14px; }
.plan-intro { color: var(--text-dim); font-size: 13px; max-width: 90ch; margin: 0 0 14px; }
.plan-h { font-family: var(--font-serif); font-weight: 400; font-size: 21px; color: var(--navy); margin: 18px 0 8px; }
.plan-sub { color: var(--text-muted); font-size: 12.5px; margin: -4px 0 8px; }
.plan-platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.plan-plat { background: var(--surface); border: var(--border-width) solid var(--line-soft); border-top: 4px solid var(--line-soft);
  border-radius: var(--radius-card); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.plan-plat.kev { border-top-color: var(--navy); }
.plan-plat.crit { border-top-color: var(--rose); }
.plan-plat-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--navy); font-size: 15px; }
.plan-plat-target { font-family: var(--font-mono); font-size: 13px; color: var(--jade); font-weight: 600; }
.plan-plat p { margin: 0; font-size: 13px; color: var(--text); }
.plan-plat-foot { margin-top: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.plan-common { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }
.plan-common-row { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.plan-common-row details { font-size: 12px; color: var(--text-dim); }
.plan-common-row summary { cursor: pointer; color: var(--text-muted); }
.plan-arrow { font-family: var(--font-mono); color: var(--jade); font-weight: 600; }
.plan-common-n { float: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.plan-apps-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.plan-apps-head .plan-h { margin: 0 0 8px; }
.plan-apps-head .sec-search { flex: 0 1 320px; margin-bottom: 8px; }
.plan-app { padding: 0; }
.plan-app-head { width: 100%; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: none; border: 0;
  text-align: left; padding: 12px 16px; cursor: pointer; color: var(--text); font: inherit; }
.plan-app-head:focus-visible { outline: 2px solid var(--pink); outline-offset: -2px; }
.plan-repo { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.plan-app-meta { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.plan-app-meta .c, .plan-n .c, .plan-plat-foot .c { color: var(--rose); }
.plan-chev { margin-left: auto; color: var(--text-muted); }
.plan-app-body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.plan-table-wrap { width: 100%; max-height: none; }
.plan-table td { padding: 8px; }
.plan-table td:first-child { min-width: 180px; }
.plan-members { font-size: 11.5px; color: var(--text-muted); max-width: 40ch; }
.plan-now { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.plan-n { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.plan-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-opt { display: inline-flex; flex-direction: column; border: var(--border-width) solid var(--line-soft); border-radius: var(--radius-input);
  padding: 4px 9px; background: var(--bg); line-height: 1.25; }
.plan-opt b { font-family: var(--font-mono); font-size: 12.5px; color: var(--navy); }
.plan-opt small { font-size: 11px; color: var(--text-muted); }
.plan-opt.full { border-color: var(--jade); background: var(--jade-soft); }
.plan-opt.full small { color: var(--text-dim); }
.plan-opt.none { border-color: var(--rose); }
.plan-opt.none b { color: var(--rose); font-family: var(--font-sans); }
.plan-trans { font-size: 12px; color: var(--text-dim); }
.plan-advs { margin-top: 4px; font-size: 12px; }
.plan-advs summary { cursor: pointer; color: var(--text-muted); }
.plan-advs div { padding: 2px 0; color: var(--text-dim); }
.plan-advs a { font-family: var(--font-mono); font-size: 11.5px; color: var(--navy); }
.plan-advs .sec-sev { font-size: 9.5px; padding: 0 5px; }

@media (max-width: 640px) {
  .plan-chev { margin-left: 0; }
  .sec-dates { margin-left: 0; width: 100%; }
  .sec-card-foot { flex-direction: column; align-items: flex-start; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs .tab { flex: 0 0 auto; }
}

/* ---- TAT tab ---- */
.tat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; margin-bottom: 18px; }
.tat-block { background: var(--surface); border: var(--border-width) solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; min-width: 0; }
.tat-block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tat-block-head .plan-h { margin: 0; }
.tat-table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; }
.tat-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tat-table th, .tat-table td { padding: 6px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.tat-table th:first-child { text-align: left; font-weight: 600; color: var(--navy); white-space: normal; }
.tat-table thead th { position: sticky; top: 0; background: var(--surface); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-dim); font-weight: 700; }
.tat-table td.tat-open { color: var(--rose); font-weight: 700; }
.tat-card.resolved { border-left-color: var(--jade); }
.tat-card.open { border-left-color: var(--gold); }
.tat-tickets a { margin-right: 2px; }
.tat-card .sec-card-title, .tat-card .sec-meta, .tat-card .sec-note { overflow-wrap: anywhere; }
.tat-groupnote { margin-bottom: 8px; }
.tat-group-toggle { all: unset; cursor: pointer; display: inline-flex; gap: 8px; align-items: baseline; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.tat-group-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.tat-caret::before { content: "\25B8"; display: inline-block; transition: transform .15s; }
.tat-group-toggle[aria-expanded="true"] .tat-caret::before { transform: rotate(90deg); }
.tat-children { margin-top: 10px; border-top: 1px solid var(--line-soft); }
.tat-children[hidden] { display: none; }
.tat-child { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.tat-child-when { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 110px; }
.tat-child-info { flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.tat-child.open .tat-child-when { color: var(--gold); }
.tat-child.resolved .tat-child-when { color: var(--jade); }
.tat-trend { margin-bottom: 16px; }
.tat-trend-scope { margin: 0; font-size: 12px; }
.tat-trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tat-spark { border: 1px solid var(--line-soft); border-radius: var(--radius-input); padding: 10px 12px 8px; min-width: 0; }
.tat-spark-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tat-spark-head span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.tat-spark-head b { font-family: var(--font-serif); font-weight: 400; font-size: 22px; color: var(--navy); font-variant-numeric: tabular-nums; }
.tat-spark svg { display: block; width: 100%; height: 70px; margin: 4px 0; }
.tat-spark .tat-grid-line { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tat-spark .tat-area { fill: var(--accent-medium); }
.tat-spark .tat-line { fill: none; stroke: var(--navy); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.tat-spark .tat-end { fill: var(--pink); stroke: var(--navy); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.tat-spark .tat-rules { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tat-spark-wait { height: 70px; margin: 4px 0; display: flex; align-items: center; font-size: 12px; color: var(--text-muted);
  border-top: 1px dashed var(--line-soft); border-bottom: 1px dashed var(--line-soft); }
.tat-spark-foot { font-size: 12px; color: var(--text-muted); }
.tat-delta { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---- Code review tab (#codereview): built on the .sec-* card; these are the extras ---- */
.cr-card { min-width: 0; }
.cr-card .sec-card-title, .cr-card .sec-meta, .cr-card .sec-note { overflow-wrap: anywhere; }
.cr-loc a { font-family: var(--font-mono); font-size: 12px; color: var(--navy); }
.cr-nofile { font-style: italic; color: var(--text-muted); }
.cr-meta { margin-top: 2px; }
.cr-meta a { font-family: var(--font-sans); font-size: 13px; color: var(--navy); }
.cr-repo-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer;
  text-decoration: underline dotted var(--line-soft); text-underline-offset: 3px; overflow-wrap: anywhere; text-align: left; }
.cr-repo-btn:hover { text-decoration-color: var(--pink); }
.cr-text { margin-top: 8px; font-size: 13px; color: var(--text); max-width: 110ch; white-space: pre-line; overflow-wrap: anywhere; }
.cr-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cr-fix { margin-top: 2px; overflow-wrap: anywhere; white-space: pre-line; }
.cr-fix.cr-clamp { -webkit-line-clamp: 2; }
.cr-review { margin-top: 10px; border: var(--border-width) dashed var(--line-soft); border-radius: var(--radius-input);
  padding: 8px 12px; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.cr-review-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); margin-bottom: 2px; }
.cr-review-head span { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); margin-left: 6px; }
.cr-review.fixed { border-style: solid; border-color: var(--jade); background: var(--jade-soft); }
.cr-review.fixed .cr-review-head { color: var(--jade); }
.cr-review.still_open { border-style: solid; border-color: var(--rose); }
.cr-review.still_open .cr-review-head { color: var(--rose); }
.cr-review.cannot_verify, .cr-review.error, .cr-review.running { border-color: var(--gold); }
.cr-review.cannot_verify .cr-review-head, .cr-review.error .cr-review-head, .cr-review.running .cr-review-head { color: var(--gold); }
.cr-ev { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cr-ev a { font-family: var(--font-mono); font-size: 12px; color: var(--navy); }
.cr-ev code { display: block; margin-top: 3px; font-family: var(--font-mono); font-size: 12px; background: var(--bg);
  border: 1px solid var(--line-soft); border-radius: 6px; padding: 4px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Fixed / It's alright note box: one line under the card foot */
.cr-note-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line-soft); }
.cr-note-input { flex: 1 1 320px; min-width: 0; }
.cr-note-input:focus-visible { outline: 2px solid var(--pink); outline-offset: 1px; }
.cr-note-box .sec-btn[disabled] { cursor: not-allowed; }
.cr-note-hint { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }

/* TAT: suggestions learned from Not valid marks */
.tat-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.tat-rules-panel { margin-bottom: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-input); padding: 8px 12px; }
.tat-rules-panel summary { cursor: pointer; font-weight: 600; color: var(--navy); font-size: 13px; }
.tat-rules-panel ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.tat-rules-panel li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; overflow-wrap: anywhere; }

/* Code review: Analysis view (#codereview/analysis). Severity colours follow .sec-card / .sec-sev. */
.cra-kpis { margin-bottom: 16px; }
.cra-kpi-sub { display: block; font-style: normal; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; max-width: 22ch; }
.cra-block { margin-bottom: 16px; }
.cra-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; height: 210px; padding-top: 4px; }
.cra-col { display: flex; flex-direction: column; min-width: 0; }
.cra-plot { position: relative; flex: 1; margin-top: 18px; border-bottom: var(--border-width) solid var(--line); }
.cra-stack { position: absolute; bottom: 0; left: 12%; right: 12%; display: flex; flex-direction: column-reverse; min-height: 2px; }
.cra-col-n { position: absolute; bottom: 100%; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 700;
  color: var(--navy); font-variant-numeric: tabular-nums; padding-bottom: 2px; }
.cra-col-x { text-align: center; font-size: 11px; color: var(--text-muted); padding-top: 4px; line-height: 1.25; white-space: nowrap; }
.cra-col.partial .cra-stack { opacity: .55; outline: 1.5px dashed var(--line); outline-offset: 1px; }
.cra-seg { display: block; flex: 0 1 0; min-height: 2px; min-width: 2px; }
.cra-seg.critical { background: var(--rose); }
.cra-seg.high { background: var(--pink); }
.cra-seg.medium { background: var(--gold); }
.cra-seg.low { background: var(--navy); opacity: .3; }
.cra-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 14px; font-size: 12px; color: var(--text-dim); }
.cra-legend .cra-seg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.cra-table th:first-child { min-width: 180px; }
.cra-table .cr-repo-btn { text-align: left; overflow-wrap: anywhere; }
.cra-barcol { width: 30%; min-width: 110px; }
.tat-table-wrap.cra-tall { max-height: 600px; }
.cra-hbar { height: 10px; }
.cra-hbar > div { display: flex; height: 100%; min-width: 2px; }
.cra-alt { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-muted); white-space: normal; overflow-wrap: anywhere; }
.cra-note { font-size: 13px; color: var(--text-dim); margin: 0 0 8px; max-width: 90ch; }
.cra-quiet td, .cra-quiet th { color: var(--text-muted); }
.cra-items { margin-top: 6px; font-size: 13px; }
.cra-items summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.cra-items ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.cra-items li { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .cra-bars { gap: 4px; height: 180px; }
  .cra-col-x { font-size: 10px; white-space: normal; }
  .cra-col-n { font-size: 10.5px; }
}

/* Needs details tab: link list and the three close-out inputs reuse the sec-* / cr-note-* primitives */
.sp-links { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.sp-links li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; word-break: break-all; }
.sp-links a { color: var(--navy); }
.sp-closeout { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 10px; }
.sp-field { display: grid; gap: 3px; }
.sp-field span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.sp-field .sec-search { min-width: 0; }

/* Needs checking view */
.sp-points { margin-top: 6px; font-size: 14px; color: var(--text-dim); }
.sp-points b { color: var(--navy); font-variant-numeric: tabular-nums; }
.sp-analysis { white-space: pre-wrap; margin-top: 8px; }
.sp-comment { width: 100%; resize: vertical; font-family: inherit; min-height: 52px; }

/* Change password modal */
.cpw-modal { max-width: 400px; }
.cpw-hint { font-size: 11px; color: var(--text-3); margin: 0; line-height: 1.5; }
.cpw-msg { font-size: 12px; margin: 0; color: var(--red); }
.cpw-msg.ok { color: var(--text); }

/* Narrow screens: let the header wrap so Change password / Log out stay reachable */
@media (max-width: 640px) {
  .header { height: auto; min-height: 64px; flex-wrap: wrap; row-gap: 8px; padding: 10px 16px; }
  .header-right { flex-wrap: wrap; row-gap: 8px; justify-content: flex-end; }
  .header-user { padding-left: 0; border-left: none; flex-wrap: wrap; }
}
