/* Client portal layout (loaded after style.css) */
body.portal { background: var(--paper); }
.portal-header { background: var(--white); border-bottom: 1px solid var(--line); }
.portal-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; min-height: 72px; padding-block: 10px; }
.portal-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.portal-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; padding: 8px 0; border-bottom: 3px solid transparent; }
.portal-nav a:hover, .portal-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--purple); }
.portal-nav .linkish { font: 500 1rem var(--body); color: var(--ink-soft); background: none; border: 0; cursor: pointer; padding: 8px 0; }
.portal-nav .linkish:hover { color: var(--ink); }
.portal-tag { font-size: .8rem; font-weight: 600; color: var(--purple); background: var(--tint); padding: 2px 10px; border-radius: 999px; margin-left: 8px; }
.portal-main { width: min(1100px, 100% - 40px); margin: 32px auto 72px; }
.portal-main h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin-bottom: 8px; }
.portal-main h2 { font-size: 1.35rem; margin-bottom: 14px; }
.portal-intro { color: var(--ink-soft); margin-bottom: 26px; max-width: 65ch; }
.portal-footer { text-align: center; color: var(--stone); font-size: .9rem; padding: 0 20px 40px; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 28px); margin-bottom: 22px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; text-decoration: none; color: var(--ink); display: grid; gap: 4px; }
.tile strong { font-family: var(--display); font-size: 2.1rem; line-height: 1; }
.tile span { color: var(--stone); }
a.tile:hover { border-color: var(--blue); }
.tile-alert { background: var(--tint); border-color: #C5CEF7; }

.callout { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; }
.callout p { color: #E6E9FF; }
.callout .btn { background: #fff; color: var(--blue-dark); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-size: .88rem; color: var(--stone); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.empty { color: var(--stone); padding: 8px 0; }

.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: #E8EAF3; color: var(--ink-soft); white-space: nowrap; }
.pill-requested, .pill-open, .pill-sent, .pill-draft { background: #EDE4FF; color: #5221B0; }
.pill-quoted, .pill-in_progress, .pill-client_signed { background: #DFE7FF; color: #1A3BA6; }
.pill-active, .pill-resolved, .pill-completed { background: #DDF1E6; color: #15603D; }
.pill-waiting_client { background: #FFF0D6; color: #7A4B00; }
.pill-urgent, .pill-high { background: #FCE4E2; color: #8C1D18; }
.pill-paused, .pill-ended, .pill-closed, .pill-cancelled, .pill-low, .pill-normal { background: #E8EAF3; color: var(--ink-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 20px; margin: 6px 0 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.check.is-disabled { opacity: .6; cursor: default; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 600; margin-bottom: 6px; }

.thread { display: grid; gap: 14px; margin-bottom: 22px; }
.msg { border-radius: 14px; padding: 16px 18px; max-width: 760px; }
.msg-client { background: var(--white); border: 1px solid var(--line); }
.msg-admin { background: var(--tint); border: 1px solid #D5DBFA; margin-left: auto; }
.msg-meta { font-size: .88rem; color: var(--stone); margin-bottom: 6px; }
.msg-body { white-space: pre-wrap; }

.auth-wrap { max-width: 520px; margin: 40px auto; }
.auth-wrap .panel { padding: clamp(24px, 4vw, 36px); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 18px; font-size: .95rem; }
.meta-list { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 8px 16px; margin: 0; }
.meta-list dt { color: var(--stone); }
.meta-list dd { margin: 0; }
