:root {
  --navy: #0e0733;
  --navy-2: #191046;
  --orange: #f7941d;
  --orange-soft: #fff1df;
  --surface: #f6f7fb;
  --paper: #ffffff;
  --ink: #17142a;
  --muted: #696477;
  --line: #e3e1eb;
  --success: #187652;
  --success-soft: #e7f7ee;
  --danger: #b22c2a;
  --danger-soft: #ffe7e5;
  --radius: 16px;
  --shadow: 0 18px 54px rgba(14, 7, 51, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 0 0, #fff 0, #f6f7fb 43rem); color: var(--ink); font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--navy); }
a:hover { color: #763c00; }

.portal-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 84px; padding: 14px clamp(20px, 4vw, 72px); background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--line); box-shadow: 0 5px 20px rgba(14, 7, 51, 0.04); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: var(--navy); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; text-decoration: none; text-transform: uppercase; }
.brand img { display: block; width: clamp(150px, 18vw, 214px); height: auto; max-height: 48px; object-fit: contain; object-position: left center; }
.brand span { padding-left: 12px; border-left: 1px solid #d9d6e3; }
.portal-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.portal-nav a { padding: 8px 10px; border-radius: 8px; color: #514c66; font-size: 13px; font-weight: 750; text-decoration: none; transition: background .16s ease, color .16s ease; }
.portal-nav a:hover, .portal-nav a:focus-visible { color: var(--navy); background: #f0eff6; outline: none; }
.portal-nav a:last-child { color: #8a3300; }

.portal-main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: clamp(34px, 5vw, 68px) 0 76px; }
.panel, .auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: clamp(25px, 4.5vw, 50px); }
.panel + .panel { margin-top: 24px; }
.auth-card { width: min(610px, 100%); margin: 4vh auto; padding: clamp(28px, 6vw, 60px); border-top: 5px solid var(--orange); }
.auth-card h1, .panel h1 { margin: 7px 0 12px; color: var(--navy); font: 700 clamp(30px, 4vw, 48px)/1.12 Georgia, "Times New Roman", serif; letter-spacing: -0.035em; }
.panel h2 { margin: 0 0 10px; color: var(--navy); font: 700 clamp(22px, 2.3vw, 31px)/1.2 Georgia, "Times New Roman", serif; }
.panel h3 { margin: 30px 0 10px; color: var(--navy); font-size: 17px; }
.panel h4 { margin: 0 0 8px; color: var(--navy); font-size: 15px; }
.hero { padding: clamp(32px, 5vw, 72px); border-radius: var(--radius); color: #fff; background: linear-gradient(135deg, var(--navy) 0%, #24145a 100%); box-shadow: var(--shadow); }
.hero h1 { max-width: 760px; margin: 8px 0 18px; font: 700 clamp(34px, 5vw, 58px)/1.06 Georgia, "Times New Roman", serif; }
.hero p { max-width: 680px; color: #e6e3f2; }
.eyebrow { margin: 0; color: var(--orange) !important; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.form-help { margin: 18px 0 25px; padding: 13px 15px; border-left: 4px solid var(--orange); border-radius: 0 9px 9px 0; background: var(--orange-soft); color: #573300; }
.form-message { margin: 18px 0; padding: 12px 14px; border-left: 4px solid var(--orange); border-radius: 9px; background: var(--orange-soft); color: #573300; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; margin-top: 16px; padding: 10px 16px; border: 1px solid var(--orange); border-radius: 9px; background: var(--orange); color: #291500; cursor: pointer; font: inherit; font-size: 14px; font-weight: 850; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover, .button:focus-visible { background: #ffab3d; color: #291500; box-shadow: 0 6px 16px rgba(247, 148, 29, .2); outline: none; transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-small { min-height: 33px; margin: 0; padding: 6px 10px; font-size: 12px; }
.button-secondary { margin-left: 8px; border-color: #d6d3e0; background: #fff; color: var(--navy); }
.button-secondary:hover { background: #f4f3f8; color: var(--navy); }

.form-stack { display: grid; gap: 16px; margin-top: 20px; }
.form-stack label, .inline-form label { display: grid; gap: 6px; color: var(--navy); font-size: 13px; font-weight: 750; }
.form-stack input, .form-stack select, .form-stack textarea, .inline-form input, .inline-form select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cac6d8; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.form-stack textarea { min-height: 100px; resize: vertical; }
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus, .inline-form input:focus, .inline-form select:focus { border-color: var(--orange); outline: 3px solid rgba(247, 148, 29, .2); }
.form-stack .button { border: 0; justify-self: start; }
.form-stack fieldset { display: grid; gap: 12px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: #fbfbfd; }
.form-stack legend { padding: 0 5px; color: var(--navy); font-weight: 800; }
.check-label { display: flex !important; align-items: center; gap: 9px !important; }
.check-label input { width: auto !important; min-height: auto !important; }
.qr-code { width: 220px; max-width: 100%; margin: 22px 0; padding: 10px; border: 1px solid var(--line); background: #fff; }
.qr-code svg { display: block; width: 100%; height: auto; }
details { color: var(--ink); }
details summary { cursor: pointer; color: var(--navy); font-weight: 800; }
details summary::marker { color: var(--orange); }
code { display: block; overflow-wrap: anywhere; padding: 10px; background: #f3f2f7; color: var(--navy); }

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-top: 24px; }
.action-grid .button { width: 100%; margin: 0; }
.data-table { width: 100%; margin-top: 14px; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; text-align: left; }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.data-table th { background: #f6f5f9; color: var(--navy); font-size: 12px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fcfcfe; }
.inline-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.inline-form > span { align-self: center; max-width: 220px; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.inline-form select, .inline-form input { min-width: 120px; }
.inline-form button, .customer-view-banner button { min-height: 36px; padding: 8px 10px; border: 1px solid var(--navy); border-radius: 7px; background: var(--navy); color: #fff; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; }
.inline-form button:hover, .customer-view-banner button:hover { background: var(--navy-2); }
.notification-form { margin-top: 8px; }
.notification-form select { min-width: 148px; }

.customer-view-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0; padding: 12px 14px; border: 1px solid #f1bd7c; border-radius: 10px; background: var(--orange-soft); color: #5d3600; }
.customer-view-banner form { margin: 0; }
.compact-list, .note-list, .file-list, .usage-list, .service-file-list { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.compact-list li, .note-list li { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.note-list span, .compact-list li span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.note-list p { margin: 8px 0 0; }
.file-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.file-list li span { color: var(--muted); font-size: 13px; }
.file-list li a { grid-row: 1 / span 2; grid-column: 2; font-weight: 800; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; }
.customer-service-category + .customer-service-category { margin-top: 36px; }
.customer-service-category > header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.customer-service-card, .admin-service-card { margin: 0; padding: 21px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 8px 22px rgba(14, 7, 51, .04); }
.service-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.service-card-heading h2, .service-card-heading h3 { margin: 4px 0 7px; color: var(--navy); font: 700 22px/1.2 Georgia, "Times New Roman", serif; }
.service-card-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 14px; }
.service-keyfacts { display: flex; flex-wrap: wrap; gap: 8px; margin: 17px 0 0; }
.service-keyfacts span { padding: 6px 9px; border-radius: 7px; background: #f3f2f7; color: #514c66; font-size: 12px; }
.service-keyfacts strong { color: var(--navy); }
.service-disclosure, .admin-details { margin-top: 14px; padding: 13px 0 0; border-top: 1px solid var(--line); }
.service-disclosure[open] summary, .admin-details[open] summary { margin-bottom: 13px; }
.service-details { display: grid; grid-template-columns: minmax(130px, .8fr) 1.6fr; gap: 8px 16px; margin: 0; }
.service-details dt { color: var(--muted); font-size: 13px; font-weight: 750; }
.service-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.status-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 8px; border-radius: 999px; background: #eeeef3; color: #504c60; font-size: 12px; font-weight: 850; white-space: nowrap; }
.status-active, .reachability-online { background: var(--success-soft); color: var(--success); }
.status-cancellation_requested { background: var(--orange-soft); color: #794200; }
.status-ended { background: #efeff3; color: #5f5a6a; }
.reachability-not_configured { background: #f1f0f4; color: #686271; }
.usage-list li, .service-file-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.usage-list li:last-child, .service-file-list li:last-child { border-bottom: 0; }
.usage-list span, .service-file-list span { color: var(--muted); }
.service-file-list a { font-weight: 800; text-align: right; }
.cancellation-disclosure { border-color: #f1cfaa; }

.upload-choice-grid, .admin-composer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.upload-card, .subpanel { padding: 21px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfd; }
.upload-card h2, .subpanel h2 { font-size: 23px; }
.upload-card p, .subpanel p { margin-top: 0; color: var(--muted); font-size: 14px; }
.service-filter { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 25px 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfd; }
.service-filter h2 { margin: 4px 0; font-size: 25px; }
.service-filter p { margin: 0; color: var(--muted); font-size: 14px; }
.service-filter .inline-form a { align-self: center; font-size: 13px; font-weight: 750; }
.admin-service-groups { display: grid; gap: 24px; }
.admin-service-group { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.admin-service-group > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 21px; background: linear-gradient(90deg, #faf9fc, #fff); border-bottom: 1px solid var(--line); }
.admin-service-group > header h2 { margin: 3px 0 0; font-size: 25px; }
.admin-service-group > header > span { color: var(--muted); font-size: 13px; font-weight: 750; }
.admin-service-list { display: grid; gap: 12px; padding: 14px; }
.admin-service-card { box-shadow: none; }
.record-management { display: grid; gap: 18px; padding-top: 4px; }
.record-management section { padding: 15px; border: 1px solid #ebe9f0; border-radius: 10px; background: #fcfcfe; }
.edit-record-form { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #dcd9e5; }
.empty-hint { margin: 11px 0 0; color: var(--muted); font-size: 13px; }

.incident-important { border-color: #ecb25d !important; background: #fff4e6 !important; }
.incident-critical { border-color: #d14943 !important; background: var(--danger-soft) !important; }
.compact-list .incident-important { background: #fff4e6; }
.compact-list .incident-critical { background: var(--danger-soft); }

.portal-footer { display: flex; justify-content: center; gap: 18px; padding: 26px 20px; border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 13px; }
.portal-footer a { color: var(--navy); font-weight: 800; }

@media (max-width: 880px) {
  .portal-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .portal-nav { justify-content: flex-start; }
  .service-filter { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  .portal-main { width: min(100% - 28px, 1240px); padding: 28px 0 52px; }
  .panel { padding: 23px 18px; }
  .auth-card { margin: 18px auto; padding: 28px 20px; }
  .brand { width: 100%; justify-content: space-between; }
  .brand img { width: 184px; }
  .portal-nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .portal-nav a { white-space: nowrap; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  .data-table .inline-form { min-width: 290px; white-space: normal; }
  .inline-form, .customer-view-banner, .service-card-heading, .admin-service-group > header { align-items: flex-start; flex-direction: column; }
  .inline-form { width: 100%; }
  .inline-form label, .inline-form input, .inline-form select { min-width: 100%; }
  .service-details { grid-template-columns: 1fr; gap: 3px; }
  .service-details dt { margin-top: 9px; }
  .file-list li { grid-template-columns: 1fr; }
  .file-list li a { grid-row: auto; grid-column: auto; }
  .portal-footer { align-items: center; flex-direction: column; gap: 5px; }
}
