:root {
  --ink: #18212f;
  --muted: #697386;
  --line: #d9e0ea;
  --soft: #f4f7fb;
  --brand: #115e67;
  --brand-dark: #0c454c;
  --danger: #a42323;
  --success: #12633d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: #eef3f7;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto;
}
.narrow { width: min(520px, calc(100vw - 32px)); }
.hidden { display: none !important; }

.auth-panel {
  max-width: 480px;
  margin: 8vh auto;
}
.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}
.mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 8px;
  font-weight: 800;
}
h1, h2, h3, p { margin-top: 0; }
.brand-row h1 { margin-bottom: 3px; }
.brand-row p, .app-header p, .stub-top p { margin-bottom: 0; color: var(--muted); }

.card, .list-card, .stub-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 44, 61, .08);
}
.card { padding: 22px; }
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 15px;
  font-family: inherit;
}
textarea { resize: vertical; }
input[type="checkbox"] {
  width: auto;
  min-height: 0;
}
button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: white;
  background: var(--brand);
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--brand-dark); }
#loginButton { margin-top: 12px; }
.secondary-button {
  color: var(--brand);
  background: white;
  border: 1px solid var(--line);
}
.secondary-button:hover {
  color: white;
  background: var(--brand);
}
.link-button {
  width: 100%;
  margin-top: 10px;
  color: var(--brand);
  background: transparent;
}
.plain-link { display: inline-block; margin-top: 14px; color: var(--brand); }
.message { margin-top: 12px; font-size: 14px; }
.message.error { color: var(--danger); }
.message.success { color: var(--success); }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.portal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 2px;
  overflow-x: auto;
}
.tab-button {
  color: var(--brand);
  background: white;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tab-button.active,
.tab-button:hover {
  color: white;
  background: var(--brand);
}
.tab-section { display: none; }
.tab-section.active { display: block; }
.toolbar {
  display: grid;
  grid-template-columns: 1fr 180px 180px;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.toolbar label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.toolbar input,
.toolbar select {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  font-size: 14px;
}
.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.summary-strip div {
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}
.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}
.layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
}
.list-card { padding: 14px; }
.list-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.stub-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  margin-bottom: 8px;
  text-align: left;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}
.stub-list-item:hover { background: #e8f0f3; }
.stub-list-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}
.empty-list {
  padding: 18px;
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.stub-card {
  min-height: 560px;
  padding: 22px;
  overflow-x: auto;
}
.empty {
  height: 420px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.stub-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
}
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.check-box {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: right;
}
.check-box span, .check-box small {
  display: block;
  color: var(--muted);
}
.check-box strong { display: block; font-size: 20px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.detail-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: -4px 0 18px;
}
.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.summary-grid span, .summary-grid small {
  display: block;
  color: var(--muted);
}
.summary-grid strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.w2-address {
  margin: 14px 0;
  padding: 12px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.w2-consent-card {
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  font-size: 14px;
}
th {
  background: var(--soft);
  color: #344054;
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}
td, th {
  border: 1px solid var(--line);
  padding: 9px;
}
.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); }
.portal-card { margin-bottom: 16px; }
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.profile-field,
.history-item,
.feature-list div {
  padding: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.profile-field span,
.feature-list span,
.history-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.profile-field strong,
.feature-list strong,
.history-item strong {
  display: block;
  margin-top: 4px;
}
.history-list,
.feature-list {
  display: grid;
  gap: 8px;
}
.feature-list button {
  width: 100%;
  text-align: left;
}
.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  text-transform: none;
}
.check-row input { margin-top: 2px; }

@media (max-width: 860px) {
  .app-header { display: block; }
  .header-actions { margin-top: 12px; flex-wrap: wrap; }
  .toolbar { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .two-column,
  .profile-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .stub-top { display: block; }
  .check-box { margin-top: 12px; text-align: left; }
}

@media print {
  body { background: white; }
  .auth-panel,
  .app-header,
  .portal-tabs,
  .toolbar,
  .summary-strip,
  .list-card,
  #tab-profile,
  #tab-office,
  #tab-account,
  .detail-actions {
    display: none !important;
  }
  .shell { width: 100%; margin: 0; }
  .layout { display: block; }
  .stub-card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}
