:root {
    --isa-deep: #003f46;
    --isa-primary: #005f66;
    --isa-primary-2: #087e80;
    --isa-soft: #d9f5ef;
    --isa-soft-2: #effaf7;
    --isa-gold: #ead8c7;
    --isa-text: #102033;
    --isa-muted: #6b7890;
    --isa-danger: #dc2626;
    --isa-success: #16a34a;
    --isa-warning: #f59e0b;
    --isa-border: #dce8e6;
    --isa-bg: #f3f8f6;
    --shadow: 0 14px 35px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--isa-bg);
    color: var(--isa-text);
}

a {
    color: inherit;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 275px;
    background: linear-gradient(180deg, #004b54 0%, #003b42 100%);
    color: white;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 22px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-box {
    width: 72px;
    height: 72px;
    background: #0b8f98;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #001f23;
    font-size: 29px;
    font-weight: 950;
    border-radius: 0;
    position: relative;
    flex: 0 0 auto;
}

.logo-box:after {
    content: "*";
    position: absolute;
    right: 6px;
    bottom: 2px;
    color: #001f23;
    font-size: 34px;
    line-height: 1;
}

.brand-title {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
}

.brand-role {
    color: #ffe96b;
    font-size: 13px;
    font-weight: 800;
    margin-top: 5px;
}

.nav-section {
    padding: 18px 14px 6px;
    color: rgba(255,255,255,.45);
    letter-spacing: 4px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 18px;
    margin: 4px 0;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    border-left: 4px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(14, 139, 148, .45);
    color: white;
    border-left-color: #9ee9dc;
}

.main {
    margin-left: 275px;
    width: calc(100% - 275px);
    min-height: 100vh;
}

.topbar {
    height: 82px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--isa-border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.top-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.top-pill {
    min-width: 180px;
    background: white;
    border: 1px solid var(--isa-border);
    border-radius: 18px;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 20px rgba(15,23,42,.04);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: #5b341c;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
}

.user-name {
    font-weight: 900;
    font-size: 14px;
}

.user-role {
    color: var(--isa-muted);
    font-size: 12px;
    font-weight: 700;
}

.content {
    padding: 28px 32px 44px;
}

.page-title {
    font-size: 25px;
    margin: 0;
    color: #004f59;
    font-weight: 950;
}

.page-subtitle {
    color: var(--isa-muted);
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
}

.hero {
    background: linear-gradient(120deg, #067376 0%, #063d46 70%, #0e1d34 100%);
    color: white;
    border-radius: 26px;
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero:after {
    content: "";
    position: absolute;
    right: -60px;
    top: -80px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    box-shadow: -50px 70px 0 rgba(255,255,255,.06);
}

.hero h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 950;
}

.hero p {
    margin: 10px 0 0;
    color: rgba(255,255,255,.82);
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.card {
    background: white;
    border: 1px solid var(--isa-border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 16px;
    color: #004f59;
    font-size: 18px;
}

.stat-label {
    color: #66758d;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    font-weight: 950;
}

.stat-value {
    margin-top: 13px;
    font-size: 30px;
    font-weight: 950;
    color: #005f66;
}

.stat-value.success {
    color: var(--isa-success);
}

.stat-value.danger {
    color: var(--isa-danger);
}

.stat-help {
    margin-top: 10px;
    font-size: 13px;
    color: var(--isa-muted);
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: var(--isa-primary);
    color: white;
    padding: 12px 18px;
    min-height: 44px;
    border-radius: 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 900;
    font-size: 14px;
}

.btn:hover {
    background: #004d55;
}

.btn-soft {
    background: #cef1eb;
    color: #00545d;
    border: 1px solid #ace6db;
}

.btn-soft:hover {
    background: #bcebe3;
}

.btn-danger {
    background: var(--isa-danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #fff1d6;
    color: #8a4b00;
    border: 1px solid #ffe0a6;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

label {
    display: block;
    font-size: 13px;
    color: #004f59;
    font-weight: 900;
    margin-bottom: 7px;
}

input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #cddfdd;
    border-radius: 14px;
    background: white;
    color: var(--isa-text);
    outline: none;
    font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #0d8b91;
    box-shadow: 0 0 0 4px rgba(13,139,145,.12);
}

small {
    color: var(--isa-muted);
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

th {
    text-align: left;
    color: #66758d;
    font-size: 11px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 13px 12px;
    border-bottom: 1px solid #e3ecea;
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid #edf3f1;
    vertical-align: middle;
    font-size: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.online {
    background: #dcfce7;
    color: #166534;
}

.offline {
    background: #fee2e2;
    color: #991b1b;
}

.active-badge {
    background: #dcfce7;
    color: #166534;
}

.disabled-badge {
    background: #f1f5f9;
    color: #64748b;
}

.alert {
    padding: 13px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    background: #dcfce7;
    color: #166534;
    font-weight: 800;
    border: 1px solid #bbf7d0;
}

.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: var(--isa-bg);
}

.login-panel {
    background: linear-gradient(135deg, #005f66, #002f38);
    color: white;
    padding: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-panel h1 {
    font-size: 42px;
    margin: 24px 0 10px;
    line-height: 1.1;
}

.login-panel p {
    color: rgba(255,255,255,.8);
    font-size: 17px;
    line-height: 1.6;
}

.login-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: white;
    border-radius: 26px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.empty {
    padding: 28px;
    text-align: center;
    color: var(--isa-muted);
    font-weight: 700;
}

.device-link {
    font-size: 12px;
    font-family: monospace;
}

@media (max-width: 980px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .app-shell {
        display: block;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        height: auto;
        padding: 18px;
        align-items: flex-start;
        gap: 14px;
        flex-direction: column;
    }

    .content {
        padding: 18px;
    }

    .login-page {
        grid-template-columns: 1fr;
    }

    .login-panel {
        padding: 34px;
    }

    .col-6,
    .col-4,
    .col-3 {
        grid-column: span 12;
    }
}

/* Quick Voice Floating Button */
.quick-voice-fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 68px;
    height: 68px;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, #007c83, #003f46);
    color: white;
    font-size: 31px;
    font-weight: 950;
    box-shadow: 0 18px 45px rgba(0, 63, 70, .35);
    z-index: 999;
    cursor: pointer;
}

.quick-voice-fab:hover {
    transform: translateY(-2px);
}

.quick-voice-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 17, 24, .64);
    z-index: 998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.quick-voice-modal-backdrop.open {
    display: flex;
}

.quick-voice-modal {
    width: min(780px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 28px;
    padding: 26px;
    box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

.quick-voice-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.quick-voice-title {
    font-size: 24px;
    font-weight: 950;
    color: #004f59;
}

.quick-voice-subtitle {
    margin-top: 5px;
    color: #6b7890;
    font-weight: 700;
}

.quick-voice-close {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 0;
    background: #f1f5f9;
    color: #0f172a;
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
}

.quick-voice-recorder {
    background: #f8fcfb;
    border: 1px solid #dce8e6;
    border-radius: 22px;
    padding: 20px;
    margin-top: 16px;
}

.quick-voice-status {
    font-weight: 900;
    color: #005f66;
    margin-bottom: 12px;
}

.quick-voice-status.recording {
    color: #dc2626;
}

.quick-voice-devices {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #dce8e6;
    border-radius: 16px;
    padding: 12px;
    background: white;
}

.quick-voice-device-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #edf3f1;
}

.quick-voice-device-item:last-child {
    border-bottom: 0;
}

.quick-voice-audio {
    width: 100%;
    margin-top: 14px;
}

@media (max-width: 720px) {
    .quick-voice-fab {
        right: 18px;
        bottom: 18px;
        width: 62px;
        height: 62px;
    }
}

/* ===============================
   PATCH 10 — UI PRO ISA BROADCAST
   =============================== */

.sidebar-brand {
    min-height: 104px;
}

.logo-box.logo-img-wrap {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    overflow: hidden;
}

.logo-box.logo-img-wrap:after {
    display: none;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    padding: 6px;
}

.content {
    max-width: 1660px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.page-head-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.pro-card {
    background: #ffffff;
    border: 1px solid #dce8e6;
    border-radius: 24px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .06);
    padding: 22px;
}

.pro-card + .pro-card {
    margin-top: 18px;
}

.section-title {
    font-size: 18px;
    font-weight: 950;
    color: #004f59;
    margin: 0 0 6px;
}

.section-subtitle {
    color: #687895;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 18px;
}

.form-grid-pro {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    margin: 0;
}

.field-help {
    color: #6b7890;
    font-size: 12px;
    font-weight: 700;
}

.input-icon-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .72;
    font-size: 14px;
}

.input-icon-wrap input,
.input-icon-wrap select {
    padding-left: 40px;
}

select {
    cursor: pointer;
}

input,
textarea,
select {
    min-height: 46px;
    font-weight: 700;
}

textarea {
    min-height: 118px;
}

.table-modern {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table-modern th {
    border: 0;
    padding: 8px 12px;
}

.table-modern td {
    background: #ffffff;
    border-top: 1px solid #e5eeee;
    border-bottom: 1px solid #e5eeee;
    padding: 16px 12px;
}

.table-modern tr td:first-child {
    border-left: 1px solid #e5eeee;
    border-radius: 18px 0 0 18px;
}

.table-modern tr td:last-child {
    border-right: 1px solid #e5eeee;
    border-radius: 0 18px 18px 0;
}

.user-mini {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 230px;
}

.user-mini-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg,#006b72,#003f46);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 950;
    flex: 0 0 auto;
}

.user-mini-name {
    font-weight: 950;
    color: #102033;
}

.user-mini-email {
    color: #61708b;
    font-size: 12px;
    font-weight: 700;
}

.role-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.inline-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 360px;
}

.inline-form-grid .full {
    grid-column: 1 / -1;
}

.permissions-layout {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr) 170px;
    gap: 16px;
    align-items: start;
    padding: 18px;
    border: 1px solid #dce8e6;
    border-radius: 24px;
    background: #ffffff;
    margin-bottom: 18px;
    box-shadow: 0 10px 25px rgba(15,23,42,.045);
}

.permission-user-panel {
    position: sticky;
    top: 104px;
    background: #f8fcfb;
    border: 1px solid #dce8e6;
    border-radius: 20px;
    padding: 16px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.permission-box {
    border: 1px solid #dce8e6;
    border-radius: 18px;
    padding: 14px;
    background: #f8fcfb;
}

.permission-box-title {
    color: #004f59;
    font-weight: 950;
    margin-bottom: 10px;
}

.permission-check {
    display: grid !important;
    grid-template-columns: 20px 1fr;
    gap: 8px;
    align-items: start;
    margin: 10px 0 !important;
    color: #102033 !important;
    font-weight: 800 !important;
}

.permission-check input {
    width: auto;
    min-height: auto;
    margin-top: 3px;
}

.permission-code {
    color: #74819a;
    font-size: 11px;
    font-weight: 800;
}

.permission-actions {
    position: sticky;
    top: 104px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zone-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.zone-chip {
    border: 1px solid #b9e7df;
    background: #e7f8f4;
    color: #00545d;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
}

.device-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.device-card {
    border: 1px solid #dce8e6;
    border-radius: 20px;
    padding: 16px;
    background: #ffffff;
}

.device-title {
    font-weight: 950;
    color: #102033;
    font-size: 16px;
}

.device-link-input {
    font-size: 12px;
    font-family: monospace;
    margin-top: 10px;
}

.quick-voice-fab {
    z-index: 2147483647 !important;
}

@media (max-width: 1200px) {
    .permissions-layout {
        grid-template-columns: 1fr;
    }

    .permission-user-panel,
    .permission-actions {
        position: relative;
        top: auto;
    }
}

@media (max-width: 760px) {
    .page-head {
        flex-direction: column;
    }

    .form-grid-pro {
        grid-template-columns: 1fr;
    }

    .col-3,
    .col-4,
    .col-6,
    .col-12 {
        grid-column: auto !important;
    }

    .inline-form-grid {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}
