:root {
    --surface: #e9eef3;
    --surface-soft: #f0f4f8;
    --surface-deep: #dfe6ed;
    --text: #334155;
    --muted: #758294;
    --primary: #1687e8;
    --primary-dark: #0b67b6;
    --danger: #d95760;
    --success: #168b64;
    --warning: #a97111;
    --border: rgba(125, 142, 159, .14);
    --shadow-raised: -10px -10px 22px rgba(255,255,255,.92), 10px 10px 22px rgba(151,166,181,.31);
    --shadow-inset: inset 5px 5px 10px rgba(166,177,189,.28), inset -5px -5px 10px rgba(255,255,255,.92);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--surface); }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--surface);
    font: 15px/1.5 "Segoe UI", Inter, Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-page { min-height: 100vh; position: relative; overflow: hidden; }
.app-orb { position: fixed; z-index: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-raised); pointer-events: none; }
.app-orb.one { width: clamp(92px, 14vw, 210px); height: clamp(92px, 14vw, 210px); left: max(-44px, 4vw); top: 18%; }
.app-orb.two { width: clamp(94px, 13vw, 190px); height: clamp(94px, 13vw, 190px); right: max(-48px, 4vw); bottom: 8%; }
.app-orb.three { width: clamp(34px, 5vw, 66px); height: clamp(34px, 5vw, 66px); right: 16%; top: 17%; }

.glass-panel, .soft-card {
    background: rgba(240, 244, 248, .87);
    border: 1px solid rgba(255,255,255,.56);
    box-shadow: var(--shadow-raised);
}
.soft-card { border-radius: 22px; }

.app-shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 42px)); margin: 0 auto; padding: 28px 0 36px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 18px; border-radius: 23px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 1.02rem; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand img { width: 39px; height: 39px; border-radius: 12px; object-fit: contain; background: var(--surface); box-shadow: var(--shadow-inset); padding: 5px; }
.brand small { display: block; color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .03em; }
.top-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.nav-link { display: inline-flex; gap: 7px; align-items: center; padding: 9px 11px; border-radius: 12px; color: #5d6a7a; font-size: .84rem; font-weight: 700; text-decoration: none; transition: background .16s ease, box-shadow .16s ease, color .16s ease; }
.nav-link:hover, .nav-link.active { color: var(--primary-dark); background: var(--surface); box-shadow: var(--shadow-inset); }
.nav-link--danger { color: var(--danger); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 35px 3px 18px; }
.page-heading h1 { margin: 0; font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -.04em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 15px;
    border: 0; border-radius: 13px; color: var(--primary-dark); background: var(--surface-soft); box-shadow: var(--shadow-raised);
    cursor: pointer; font-size: .84rem; font-weight: 750; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, color .16s ease;
}
.btn:hover { transform: translateY(-2px); color: var(--primary-dark); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-inset); }
.btn:focus-visible, .input:focus-visible, .check-input:focus-visible { outline: 3px solid rgba(22,135,232,.27); outline-offset: 2px; }
.btn--primary { color: #0873c8; }
.btn--danger { color: var(--danger); }
.btn--success { color: var(--success); }
.btn--small { min-height: 34px; padding: 7px 10px; font-size: .76rem; }
.btn--full { width: 100%; }

.alert { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 20px; padding: 13px 15px; border-radius: 14px; box-shadow: var(--shadow-inset); font-size: .86rem; }
.alert--success { color: #136548; background: #dff4eb; }
.alert--danger { color: #a63f46; background: #fae5e6; }
.alert--warning { color: #8b5e11; background: #fff3d9; }
.alert--info { color: #1d628a; background: #e2f4ff; }

.form-card { max-width: 690px; margin: 0 auto; padding: 27px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid .form-field--wide { grid-column: 1 / -1; }
.form-field { min-width: 0; }
.form-spaced { margin-top: 17px; }
.form-label { display: block; margin: 0 0 8px 3px; color: #5e6c7c; font-size: .78rem; font-weight: 750; }
.input, .textarea, .select {
    display: block; width: 100%; border: 0; border-radius: 13px; outline: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-inset);
}
.input, .select { min-height: 47px; padding: 11px 13px; }
.textarea { min-height: 112px; padding: 12px 13px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #9ba7b4; }
.input:focus, .textarea:focus, .select:focus { box-shadow: inset 4px 4px 9px rgba(166,177,189,.25), inset -4px -4px 9px rgba(255,255,255,.95), 0 0 0 3px rgba(22,135,232,.12); }
.input[readonly] { color: var(--muted); }
.form-help { display: block; margin: 7px 3px 0; color: var(--muted); font-size: .73rem; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.check-list { max-height: 240px; overflow: auto; padding: 11px; border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-inset); }
.check-row { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; color: #526171; font-size: .84rem; }
.check-row:hover { background: rgba(255,255,255,.35); }
.check-input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-icon { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; background: var(--surface-soft); }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table th, .data-table td { padding: 14px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { color: #5d6a79; background: rgba(224,231,238,.58); font-size: .72rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.data-table tbody tr:hover { background: rgba(255,255,255,.34); }
.table-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.app-thumb { width: 39px; height: 39px; border-radius: 11px; object-fit: cover; background: var(--surface); box-shadow: var(--shadow-inset); }
.table-app { display: inline-flex; align-items: center; gap: 10px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 9px; font-size: .7rem; font-weight: 800; }
.badge--active { color: #137052; background: #ddf3e9; }
.badge--inactive { color: #697686; background: #e4e9ee; }
.empty-state { padding: 42px 26px; color: var(--muted); text-align: center; }

.portal-hero { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 27px; }
.portal-user { display: flex; align-items: center; gap: 16px; }
.avatar { display: grid; width: 60px; height: 60px; flex: 0 0 auto; place-items: center; border-radius: 18px; color: var(--primary); background: var(--surface-soft); box-shadow: var(--shadow-raised); font-size: 1.4rem; }
.portal-user h1 { margin: 0; font-size: 1.38rem; letter-spacing: -.035em; }
.portal-user p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.section-title { margin: 34px 3px 17px; font-size: 1.05rem; letter-spacing: -.02em; }
.section-title small { display: block; margin-top: 4px; color: var(--muted); font-size: .77rem; font-weight: 500; }
.app-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 19px; }
.app-card { display: flex; min-height: 170px; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 15px; border-radius: 22px; color: var(--text); background: rgba(240,244,248,.88); box-shadow: var(--shadow-raised); text-align: center; text-decoration: none; transition: transform .18s ease, color .18s ease; }
.app-card:hover { transform: translateY(-5px); color: var(--primary-dark); }
.app-card__icon { display: grid; width: 68px; height: 68px; place-items: center; overflow: hidden; border-radius: 19px; color: var(--primary); background: var(--surface-soft); box-shadow: var(--shadow-raised); font-size: 1.5rem; }
.app-card__icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card__name { overflow-wrap: anywhere; font-size: .9rem; font-weight: 800; }
.tool-grid { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.tool-card { min-height: 121px; }

.login-page { position: relative; z-index: 1; display: grid; min-height: 100vh; place-items: center; padding: 35px 18px; }
.login-card { width: min(100%, 440px); padding: 33px; border-radius: 30px; }
.login-brand { text-align: center; }
.logo-shell { display: inline-grid; width: 68px; height: 68px; place-items: center; border-radius: 50%; background: var(--surface-soft); box-shadow: var(--shadow-raised); }
.logo-shell img { width: 46px; height: 46px; object-fit: contain; }
.login-brand h1 { margin: 17px 0 5px; color: #2f3d4c; font-size: 1.55rem; letter-spacing: -.04em; }
.login-brand p { margin: 0; color: var(--muted); font-size: .84rem; }
.login-form { margin-top: 27px; }
.input-icon-wrap { display: flex; align-items: center; gap: 10px; padding: 0 13px; border-radius: 14px; color: #8b98a7; background: var(--surface); box-shadow: var(--shadow-inset); }
.input-icon-wrap:focus-within { color: var(--primary); box-shadow: inset 4px 4px 9px rgba(166,177,189,.25), inset -4px -4px 9px rgba(255,255,255,.95), 0 0 0 3px rgba(22,135,232,.12); }
.input-icon-wrap .input {
    min-width: 0;
    min-height: 50px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.input-icon-wrap .input:focus { background: transparent; box-shadow: none; }
.input-icon-wrap .input:-webkit-autofill,
.input-icon-wrap .input:-webkit-autofill:hover,
.input-icon-wrap .input:-webkit-autofill:focus,
.input-icon-wrap .input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    background-color: transparent !important;
    -webkit-background-clip: text;
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    transition: background-color 9999s ease-out 0s;
}
.password-toggle { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 9px; color: #8492a1; background: transparent; cursor: pointer; }
.password-toggle:hover { color: var(--primary); }
.login-meta { display: flex; justify-content: space-between; gap: 12px; margin: 12px 2px 21px; color: var(--muted); font-size: .75rem; }
.login-meta span { display: inline-flex; align-items: center; gap: 6px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 0; color: #99a5b3; font-size: .71rem; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(144,157,170,.42)); content: ""; }
.login-divider::after { transform: rotate(180deg); }
.login-footer { margin: 24px 0 0; color: #8c99a7; font-size: .73rem; line-height: 1.5; text-align: center; }

.app-footer { position: relative; z-index: 1; margin: 34px auto 0; color: var(--muted); font-size: .74rem; text-align: center; }

@media (max-width: 880px) { .app-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 690px) {
    .app-shell { width: min(100% - 28px, 1180px); padding-top: 16px; }
    .topbar { align-items: flex-start; flex-direction: column; gap: 11px; padding: 14px; }
    .top-nav { justify-content: flex-start; }
    .page-heading, .portal-hero { align-items: flex-start; flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .app-card { min-height: 150px; padding: 16px 10px; }
    .login-card { padding: 28px 22px; border-radius: 25px; }
    .table-card { margin-left: -1px; margin-right: -1px; }
}
