:root {
    --ink: #101828;
    --muted: #667085;
    --line: #e6eaf0;
    --surface: #ffffff;
    --canvas: #f5f7fb;
    --primary: #00a98f;
    --primary-dark: #007d72;
    --nav: #043f4b;
    --success: #008f7a;
    --warning: #d98c20;
    --danger: #d6455d;
    --radius: 16px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: inherit; }
a { transition: color .2s ease, background .2s ease, border-color .2s ease; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 700; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.uk-button { border-radius: 9px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.uk-button-primary { background: var(--primary); }
.uk-button-primary:hover, .uk-button-primary:focus { background: var(--primary-dark); }
.uk-input, .uk-select, .uk-textarea { border: 1px solid #d7dce5; border-radius: 9px; color: var(--ink); background: #fff; }
.uk-input:focus, .uk-select:focus, .uk-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,169,143,.1); }
.uk-form-label { margin-bottom: 7px; color: #344054; font-size: 13px; font-weight: 700; }
.uk-alert-danger, .uk-alert-success, .uk-alert-warning { border-radius: 10px; }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.1fr) minmax(440px, .9fr); background: #fff; }
.login-visual { position: relative; overflow: hidden; padding: 70px; color: #fff; background: radial-gradient(circle at 74% 18%, rgba(50,209,179,.27), transparent 31%), radial-gradient(circle at 12% 88%, rgba(0,169,143,.2), transparent 30%), linear-gradient(145deg, #03343e 0%, #005f67 58%, #007f78 100%); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; width: 380px; height: 380px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.login-visual::before { right: -90px; bottom: -160px; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.015); }
.login-visual::after { width: 220px; height: 220px; left: -110px; top: 17%; }
.login-visual__content { position: relative; z-index: 1; display: flex; min-height: calc(100vh - 140px); max-width: 620px; flex-direction: column; justify-content: center; }
.login-visual .eyebrow { margin-top: 38px; color: #77e0cd; }
.login-visual h1 { margin: 14px 0 25px; color: #fff; font-size: clamp(40px, 4vw, 66px); line-height: 1.05; }
.login-lead { max-width: 550px; color: rgba(255,255,255,.7); font-size: 18px; line-height: 1.65; }
.login-feature-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 50px; }
.login-feature-grid div { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; color: rgba(255,255,255,.84); background: rgba(255,255,255,.055); backdrop-filter: blur(12px); font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 55px; background: #fff url('brand/exata-background.jpg') center / cover no-repeat; }
.login-card { width: 100%; max-width: 455px; padding: 38px; border: 1px solid rgba(0,143,122,.13); border-radius: 18px; background: rgba(255,255,255,.93); box-shadow: 0 24px 65px rgba(0,75,82,.12); backdrop-filter: blur(6px); }
.login-card h2 { margin: 4px 0 8px; font-size: 34px; }
.login-card .uk-form-large { height: 54px; font-size: 15px; }
.login-footer { margin-top: 34px; color: #98a2b3; font-size: 12px; text-align: center; }

/* Portal structure */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; width: 256px; padding: 28px 18px 20px; flex-direction: column; background: var(--nav); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff !important; text-decoration: none; }
.brand-logo { display: block; width: auto; object-fit: contain; }
.brand-logo--hero { width: 190px; max-height: 68px; object-position: left center; }
.brand-logo--login { width: 145px; }
.brand-logo--sidebar { width: 135px; max-height: 44px; object-position: left center; }
.brand-logo--mobile { width: 100px; max-height: 38px; object-position: left center; }
.brand-product { padding-left: 11px; border-left: 1px solid rgba(255,255,255,.22); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: -2px; color: #90c9c3; font-size: 11px; }
.sidebar-nav { margin-top: 48px; }
.sidebar-nav p { margin: 26px 13px 9px; color: #697287; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.sidebar-nav a { display: flex; align-items: center; gap: 13px; margin: 4px 0; padding: 12px 13px; border-radius: 9px; color: #aeb6c7; font-size: 13px; font-weight: 600; text-decoration: none; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-nav a.active { color: #fff; background: rgba(0,169,143,.24); }
.sidebar-nav a.active svg { color: #6de0cd; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 15px 10px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user strong, .sidebar-user small { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: #fff; font-size: 11px; }
.sidebar-user small { color: #7f899e; font-size: 9px; text-transform: uppercase; }
.sidebar-user button { padding: 5px; border: 0; color: #778197; background: transparent; cursor: pointer; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; color: #fff; background: #009b85; font-size: 12px; font-weight: 800; }
.avatar--large { width: 64px; height: 64px; margin: 0 auto 16px; font-size: 22px; }
.main-content { min-height: 100vh; margin-left: 256px; padding: 44px clamp(28px, 4vw, 64px) 70px; }
.mobile-header { display: flex; height: 65px; padding: 0 20px; align-items: center; justify-content: space-between; background: var(--nav); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 32px; }
.page-heading h1 { margin: 2px 0 7px; font-size: 32px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.page-heading--back, .page-heading--detail { align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 13px; color: var(--muted); font-size: 12px; text-decoration: none; }
.title-with-status { display: flex; align-items: center; gap: 14px; }

/* Cards and tables */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 17px; }
.metric-card { display: flex; min-height: 132px; padding: 23px; align-items: flex-start; gap: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 5px rgba(16,24,40,.025); }
.metric-card p, .metric-card strong, .metric-card small { display: block; margin: 0; }
.metric-card p { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card strong { margin: 4px 0 2px; color: var(--ink); font-size: 29px; letter-spacing: -.04em; }
.metric-card small { color: #98a2b3; font-size: 10px; }
.metric-icon { display: grid; width: 43px; height: 43px; flex: 0 0 43px; place-items: center; border-radius: 11px; }
.metric-icon.violet { color: #008f7a; background: #e0f7f2; }
.metric-icon.green { color: #158a5d; background: #e3f7ee; }
.metric-icon.blue { color: #3578ca; background: #e8f2ff; }
.metric-icon.amber { color: #c47a13; background: #fff2dd; }
.panel-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 7px rgba(16,24,40,.025); }
.panel-card__header { display: flex; min-height: 79px; padding: 20px 25px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-card__header--compact { padding-block: 17px; }
.panel-card__header h3, .panel-card__header p { margin: 0; }
.panel-card__header h3 { font-size: 15px; }
.panel-card__header p { margin-top: 3px; color: #98a2b3; font-size: 11px; }
.text-link { color: var(--primary); font-size: 12px; font-weight: 700; text-decoration: none; }
.integration-table { margin: 0; }
.integration-table th { padding: 13px 18px; color: #98a2b3; background: #fbfcfe; font-size: 9px; font-weight: 800; letter-spacing: .07em; }
.integration-table td { padding: 15px 18px; vertical-align: middle; color: #475467; font-size: 11px; text-transform: none; }
.integration-table tr:last-child td { border-bottom: 0; }
.integration-name { display: flex; min-width: 210px; align-items: center; gap: 11px; color: var(--ink) !important; text-decoration: none; }
.integration-name strong, .integration-name small { display: block; }
.integration-name strong { font-size: 12px; }
.integration-name small { margin-top: 2px; color: #98a2b3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.table-subline { display: block; max-width: 230px; margin-top: 4px; overflow: hidden; color: #98a2b3; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.error-detail-button { display: inline-flex; padding: 5px 8px; align-items: center; gap: 5px; border: 1px solid #f2c9cf; border-radius: 7px; color: #b4233b; background: #fff5f6; font-size: 9px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.error-detail-button:hover { border-color: #e79aa6; color: #8e162b; background: #ffecef; }
.lot-error-modal { max-width: 820px; border-radius: 16px; }
.lot-error-item { margin-top: 14px; padding: 16px 18px; border: 1px solid #f0d5d9; border-left: 4px solid #d6455d; border-radius: 10px; background: #fff8f9; }
.lot-error-item__header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.lot-error-item__header strong { color: #b4233b; font-size: 11px; }
.lot-error-item__header span, .lot-error-item small { color: #7a5660; font-size: 10px; }
.lot-error-item p { margin: 9px 0; color: #56353d; font-size: 12px; line-height: 1.55; }
.table-icon { display: grid; width: 35px; height: 35px; flex: 0 0 35px; place-items: center; border-radius: 9px; color: #008f7a; background: #e0f7f2; }
.row-action { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #98a2b3; }
.status-badge { display: inline-flex; min-width: fit-content; padding: 5px 9px; align-items: center; gap: 6px; border-radius: 20px; font-size: 9px; font-weight: 800; }
.status-badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-production { color: #087a50; background: #e5f8ef; }
.badge-inactive { color: #667085; background: #eef0f4; }
.badge-test { color: #b16b0b; background: #fff3df; }
.search-box { width: 245px; }
.search-box .uk-input { height: 38px; font-size: 12px; }
.empty-state { padding: 55px 25px; color: #98a2b3; text-align: center; }
.empty-state h2, .empty-state h3 { margin: 17px 0 6px; }

/* Forms and details */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 21px; align-items: start; }
.form-card { padding: 28px; }
.form-layout .form-card:nth-of-type(2) { grid-column: 1; }
.section-title { display: flex; align-items: center; gap: 14px; margin-bottom: 27px; }
.section-title h3, .section-title p { margin: 0; }
.section-title h3 { font-size: 16px; }
.section-title p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.section-number { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 9px; color: var(--primary); background: #e0f7f2; font-size: 11px; font-weight: 800; }
.form-summary { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 30px; padding: 27px; }
.form-summary h3 { margin: 4px 0 25px; font-size: 19px; }
.provision-list li { display: flex; align-items: center; gap: 9px; padding: 5px 0; color: #475467; font-size: 12px; }
.provision-list svg { color: var(--success); }
.form-note { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 14px 0 0; color: #98a2b3; font-size: 9px; }
.environment-options { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.environment-option { display: flex; min-height: 88px; padding: 17px; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.environment-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,169,143,.09); }
.environment-option strong, .environment-option small { display: block; }
.environment-option strong { color: var(--ink); font-size: 12px; }
.environment-option small { margin-top: 3px; color: #98a2b3; font-size: 9px; }
.environment-option__icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; }
.environment-option__icon.amber { color: #bd7410; background: #fff1dc; }
.environment-option__icon.green { color: #168157; background: #e3f7ee; }
.token-reveal { display: flex; padding: 18px 21px; align-items: center; gap: 17px; border: 1px solid #9bd9cf; border-radius: 13px; background: #ecfaf7; }
.token-reveal p { margin: 2px 0 10px; color: var(--muted); font-size: 11px; }
.token-reveal code { display: block; max-width: 100%; overflow: auto; padding: 8px 10px; border-radius: 6px; color: #006e65; background: rgba(255,255,255,.7); font-size: 10px; white-space: nowrap; }
.token-reveal__icon { display: grid; width: 41px; height: 41px; place-items: center; border-radius: 10px; color: #fff; background: var(--primary); }
.detail-grid { display: grid; grid-template-columns: repeat(2,1fr); margin: 0; }
.detail-grid div { padding: 21px 25px; border-bottom: 1px solid var(--line); }
.detail-grid div:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.detail-grid dt { color: #98a2b3; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.detail-grid dd { margin: 7px 0 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.detail-grid code { color: #007d72; }
.environment-switch { display: flex; padding: 22px 25px; align-items: center; justify-content: space-between; gap: 22px; border-top: 1px solid var(--line); }
.environment-switch h4, .environment-switch p { margin: 0; }
.environment-switch h4 { color: var(--ink); font-size: 14px; }
.environment-switch p { max-width: 620px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.environment-switch small { display: block; margin-top: 7px; color: #98a2b3; font-size: 10px; }
.environment-switch__controls { display: flex; min-width: 330px; align-items: center; gap: 10px; }
.environment-switch__controls .uk-select { height: 38px; font-size: 12px; }
.environment-switch__controls .uk-button { white-space: nowrap; }
.health-card { padding: 32px; text-align: center; }
.health-card h3 { margin: 17px 0 8px; font-size: 16px; }
.health-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.health-icon { display: grid; width: 52px; height: 52px; margin: auto; place-items: center; border-radius: 50%; color: var(--success); background: #e3f7ee; }
.danger-zone { display: flex; padding: 24px 27px; align-items: center; justify-content: space-between; gap: 28px; border-color: #f0c7cd; background: #fffafa; }
.danger-zone__content { display: flex; align-items: center; gap: 17px; }
.danger-zone__content h3, .danger-zone__content p { margin: 0; }
.danger-zone__content h3 { color: #8f1830; font-size: 15px; }
.danger-zone__content p { max-width: 720px; margin-top: 5px; color: #7a5660; font-size: 11px; line-height: 1.55; }
.danger-zone__content small { display: block; margin-top: 6px; color: #b4233b; font-size: 10px; font-weight: 700; }
.danger-zone__icon { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 11px; color: #b4233b; background: #fde8eb; }
.danger-button { border: 1px solid #b4233b; color: #fff; background: #b4233b; }
.danger-button:hover { border-color: #8f1830; color: #fff; background: #8f1830; }
.danger-button:disabled { border-color: #e2b8bf; color: #fff; background: #dbaab3; cursor: not-allowed; }
.reset-modal { max-width: 620px; border-radius: 16px; }
.reset-modal > p { color: #667085; font-size: 12px; line-height: 1.65; }
.danger-eyebrow { color: #b4233b !important; }
.reset-warning { display: flex; margin: 20px 0; padding: 13px 15px; align-items: center; gap: 9px; border: 1px solid #f0c7cd; border-radius: 9px; color: #8f1830; background: #fff3f5; font-size: 11px; }
.profile-summary { padding: 34px; text-align: center; }
.profile-summary h3 { margin: 0 0 4px; }
.profile-summary p { margin: 0 0 15px; color: var(--muted); font-size: 12px; }
.maintenance-search { padding: 24px; }
.maintenance-context { display: flex; padding: 24px 27px; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.maintenance-context h2, .maintenance-context p { margin: 0; }
.maintenance-context p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.maintenance-context code { color: #007d72; }
.maintenance-table td { vertical-align: top; }
.maintenance-actions { min-width: 160px; }
.maintenance-actions form + form { margin-top: 8px; }
.maintenance-actions .uk-button { width: 100%; justify-content: center; }
.maintenance-action-help { display: block; max-width: 180px; margin-top: 7px; color: #98a2b3; font-size: 9px; line-height: 1.35; }
.maintenance-details { margin-top: 10px; display: grid; gap: 8px; min-width: 280px; }
.maintenance-details div { padding: 9px 10px; border: 1px solid #eef0f4; border-radius: 8px; background: #fbfcfe; }
.maintenance-details strong, .maintenance-details small { display: block; }
.maintenance-details strong { color: var(--ink); font-size: 11px; }
.maintenance-details small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.danger-text { color: #b4233b; }
details summary { cursor: pointer; color: var(--primary-dark); font-weight: 800; }

@media (max-width: 1200px) {
    .metric-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 959px) {
    .login-shell { display: block; }
    .login-panel { min-height: 100vh; padding: 35px 24px; }
    .main-content { margin-left: 0; padding: 30px 20px 60px; }
    .form-layout { grid-template-columns: 1fr; }
    .form-layout .form-card:nth-of-type(2), .form-summary { grid-column: 1; grid-row: auto; }
    .form-summary { position: static; }
}
@media (max-width: 639px) {
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading .uk-button { width: 100%; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 110px; }
    .panel-card__header { align-items: stretch; flex-direction: column; }
    .search-box { width: 100%; }
    .environment-options, .detail-grid { grid-template-columns: 1fr; }
    .detail-grid div, .detail-grid div:nth-child(odd) { border-right: 0; border-bottom: 1px solid var(--line); }
    .token-reveal { align-items: stretch; flex-direction: column; }
    .environment-switch { align-items: stretch; flex-direction: column; }
    .environment-switch__controls { min-width: 0; flex-direction: column; align-items: stretch; }
    .danger-zone { align-items: stretch; flex-direction: column; }
    .danger-zone .danger-button { width: 100%; }
    .maintenance-context { align-items: flex-start; flex-direction: column; }
}
