/* Custom Styling for Al-Rafidain Water Quality Web Portal */
:root {
    --bg-dark: #071324;
    --bg-gradient: linear-gradient(135deg, #0b1c31 0%, #061221 100%);
    --card-bg: rgba(16, 30, 49, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #2b6cb0;
    --primary-light: #4299e1;
    --accent-blue: #00b4d8;
    
    --text-main: #f7fafc;
    --text-muted: #a0aec0;
    --divider-color: rgba(255, 255, 255, 0.1);
    
    /* Alarm Fills & Border Colors */
    --safe-bg: rgba(56, 161, 105, 0.15);
    --safe-border: #38a169;
    --safe-text: #48bb78;

    --caution-bg: rgba(214, 158, 46, 0.15);
    --caution-border: #d69e2e;
    --caution-text: #ecc94b;

    --danger-bg: rgba(229, 62, 62, 0.18);
    --danger-border: #e53e3e;
    --danger-text: #fc8181;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px 20px 24px;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
}

.tab-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

#mainApp.chat-panel-active #mainNav {
    display: none !important;
}

#mainApp.chat-panel-active .tab-content-wrapper {
    gap: 0;
}

#mainApp.chat-panel-active #viewChatPanel.tab-view.active {
    min-height: calc(100vh - 150px);
}

/* ====================================================================
   1. LOGIN PORTAL STYLE (Glassmorphism & Wave Effects)
   ==================================================================== */
.login-portal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 25px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
}

.login-logo {
    font-size: 45px;
    color: var(--accent-blue);
    margin-bottom: 12px;
    animation: swim 3s ease-in-out infinite alternate;
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.login-header p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 16px;
}

.login-error {
    background: rgba(229, 62, 62, 0.12);
    border: 1px solid var(--danger-border);
    border-radius: 8px;
    color: var(--danger-text);
    padding: 8px 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer {
    text-align: center;
    border-top: 1px solid var(--divider-color);
    padding-top: 15px;
}

.login-footer p {
    font-size: 11px;
    color: var(--text-muted);
}

/* ====================================================================
   2. HEADER & TABS STYLING
   ==================================================================== */
.app-header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    padding: 14px 18px 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    width: 100%;
    flex-shrink: 0;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.logo-text {
    min-width: 0;
}

.logo-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--accent-blue, #3b82f6);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.28);
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
    flex-shrink: 0;
}

.fish-icon {
    font-size: 28px;
    flex-shrink: 0;
    color: var(--accent-blue);
    animation: swim 3s ease-in-out infinite alternate;
}

@keyframes swim {
    0% { transform: translateY(0) rotate(-5deg); }
    100% { transform: translateY(-5px) rotate(5deg); }
}

.logo-area h1 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

.logo-area p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Navigation Hub — 3-tier tile layout */
.app-nav-hub {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-hub-row {
    display: grid;
    gap: 10px;
    align-items: stretch;
}

.nav-hub-row--primary,
.nav-hub-row--mgmt {
    grid-template-columns: repeat(2, 1fr);
}

.nav-hub-row--primary.nav-hub-row--solo,
.nav-hub-row--mgmt.nav-hub-row--solo,
.nav-hub-row--rehab {
    grid-template-columns: 1fr;
}

.nav-hub-row--mgmt.hidden,
.nav-hub-row--rehab.hidden {
    display: none;
}

.nav-hub-row--ops,
.nav-hub-row--tools {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}

.nav-hub-sections {
    display: contents;
}

.nav-tile {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 8px;
    min-height: 76px;
    padding: 12px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    border-width: 1px;
    border-style: solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.nav-tile i {
    font-size: 20px;
    opacity: 0.95;
}

.nav-tile span {
    display: block;
    max-width: 100%;
}

.nav-tile--dashboard {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.28) 0%, rgba(79, 70, 229, 0.14) 100%);
    border-color: rgba(129, 140, 248, 0.45);
    color: #c7d2fe;
}

.nav-tile--corr {
    background: linear-gradient(145deg, rgba(2, 132, 199, 0.28) 0%, rgba(3, 105, 161, 0.14) 100%);
    border-color: rgba(56, 189, 248, 0.4);
    color: #bae6fd;
}

.nav-tile--chat {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.3) 0%, rgba(29, 78, 216, 0.14) 100%);
    border-color: rgba(96, 165, 250, 0.45);
    color: #bfdbfe;
}

.nav-tile--admin {
    background: linear-gradient(145deg, rgba(100, 116, 139, 0.35) 0%, rgba(71, 85, 105, 0.18) 100%);
    border-color: rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
}

.nav-tile--watch {
    position: relative;
    background: linear-gradient(145deg, rgba(220, 38, 38, 0.28) 0%, rgba(185, 28, 28, 0.14) 100%);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.nav-tile-badge {
    position: absolute;
    top: 6px;
    left: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.nav-tile--hatchery {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.26) 0%, rgba(124, 58, 237, 0.12) 100%);
    border-color: rgba(167, 139, 250, 0.4);
    color: #ddd6fe;
}

.nav-tile--earthen {
    background: linear-gradient(145deg, rgba(180, 83, 9, 0.3) 0%, rgba(146, 64, 14, 0.14) 100%);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

.nav-tile--marine {
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.32) 0%, rgba(13, 148, 136, 0.14) 100%);
    border-color: rgba(45, 212, 191, 0.35);
    color: #99f6e4;
}

.nav-tile--feed-wh {
    background: linear-gradient(145deg, rgba(234, 88, 12, 0.28) 0%, rgba(194, 65, 12, 0.14) 100%);
    border-color: rgba(251, 146, 60, 0.4);
    color: #fed7aa;
}

.nav-tile--feed {
    background: linear-gradient(145deg, rgba(22, 163, 74, 0.28) 0%, rgba(21, 128, 61, 0.14) 100%);
    border-color: rgba(74, 222, 128, 0.35);
    color: #bbf7d0;
}

.nav-tile--health {
    background: linear-gradient(145deg, rgba(220, 38, 38, 0.26) 0%, rgba(185, 28, 28, 0.12) 100%);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
}

.nav-tile--excel {
    background: linear-gradient(145deg, rgba(21, 128, 61, 0.22) 0%, rgba(22, 101, 52, 0.12) 100%);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.nav-tile--sync {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.26) 0%, rgba(29, 78, 216, 0.12) 100%);
    border-color: rgba(96, 165, 250, 0.4);
    color: #bfdbfe;
}

.nav-tile--records {
    background: linear-gradient(145deg, rgba(71, 85, 105, 0.32) 0%, rgba(51, 65, 85, 0.16) 100%);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

.nav-tile--kpi {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.14) 100%);
    border-color: rgba(96, 165, 250, 0.45);
    color: #dbeafe;
}

.nav-tile--rehab {
    background: linear-gradient(145deg, rgba(13, 148, 136, 0.3) 0%, rgba(15, 118, 110, 0.14) 100%);
    border-color: rgba(45, 212, 191, 0.45);
    color: #ccfbf1;
}

.nav-tile--overtime {
    background: linear-gradient(145deg, rgba(109, 40, 217, 0.26) 0%, rgba(91, 33, 182, 0.12) 100%);
    border-color: rgba(167, 139, 250, 0.35);
    color: #ddd6fe;
}

.nav-tile:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    color: #fff;
}

.nav-tile.active {
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 6px 18px rgba(0, 0, 0, 0.25);
    color: #fff;
    filter: brightness(1.12);
}

/* Legacy flat nav (fallback) */
.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-tab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-muted);
    padding: 7px 14px;
    cursor: pointer;
    pointer-events: auto;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
    white-space: nowrap;
    flex: 0 0 auto;
    line-height: 1.3;
}

.nav-tab i {
    font-size: 13px;
    flex-shrink: 0;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.2);
}

/* Header User Details */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    max-width: min(240px, 38vw);
}

.user-badge i {
    color: var(--accent-blue);
    flex-shrink: 0;
}

.user-badge-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.user-display-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.role-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 180, 216, 0.15);
    color: var(--accent-blue);
    padding: 2px 7px;
    border-radius: 8px;
    border: 1px solid rgba(0, 180, 216, 0.2);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.2);
    color: var(--danger-text);
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.header-update-btn {
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.28);
    color: #60a5fa;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 15px;
    padding: 0;
}

.header-update-btn:hover {
    background: rgba(37, 99, 235, 0.22);
    transform: scale(1.05);
}

body.light-mode .header-update-btn {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.22);
    color: #2563eb;
}

.logout-btn:hover {
    background: var(--danger-border);
    color: white;
    box-shadow: 0 0 10px rgba(229, 62, 62, 0.3);
}

/* Tab View switching — يجب أن يتغلب على .app-workspace */
.app-workspace.tab-view {
    display: none !important;
}

.app-workspace.tab-view.active {
    display: grid !important;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

/* تبويب السجلات بعرض كامل */
#viewCorrespondencePanel.app-workspace.tab-view.active,
#viewChatPanel.app-workspace.tab-view.active,
#viewRecordsPanel.app-workspace.tab-view.active,
#viewDashboardPanel.app-workspace.tab-view.active,
#viewRehabPanel.app-workspace.tab-view.active,
#viewHealthPanel.app-workspace.tab-view.active,
#viewHrPanel.app-workspace.tab-view.active,
#viewKpiPanel.app-workspace.tab-view.active,
#viewFeedWarehousePanel.app-workspace.tab-view.active,
#viewFeedPanel.app-workspace.tab-view.active,
#viewFieldSheetPanel.app-workspace.tab-view.active,
#viewSyncPanel.app-workspace.tab-view.active,
#viewExcelFilesPanel.app-workspace.tab-view.active,
#viewHrPanel.app-workspace.tab-view.active {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: 1fr !important;
    gap: 14px;
    width: 100%;
}

/* ====================================================================
   3. DATA WORKSPACE & CARDS
   ==================================================================== */
.app-workspace {
    gap: 20px;
}

@media (max-width: 900px) {
    .app-workspace.tab-view.active {
        grid-template-columns: 1fr !important;
    }
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header {
    border-bottom: 1px solid var(--divider-color);
    padding-bottom: 15px;
}

.card-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Form Styles */
.entry-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

select, input, textarea {
    width: 100%;
    background: rgba(7, 19, 36, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-main);
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    transition: all 0.25s ease;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(0, 180, 216, 0.4);
}

select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.divider {
    height: 1px;
    background: var(--divider-color);
    margin: 10px 0;
}

/* Parameters fields grid */
.parameters-title {
    margin-bottom: 5px;
}

.parameters-title h3 {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.parameters-title p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dynamic-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    padding: 15px;
    border-radius: 12px;
    border: 1px dashed var(--divider-color);
}

.empty-state-text {
    grid-column: span 2;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px;
    font-style: italic;
}

/* Dynamic input status colors (Green, Yellow, Red glow) */
.input-safe {
    border-color: var(--safe-border) !important;
    background: var(--safe-bg) !important;
    color: var(--text-main) !important;
    box-shadow: 0 0 6px rgba(56, 161, 105, 0.2);
}

.input-caution {
    border-color: var(--caution-border) !important;
    background: var(--caution-bg) !important;
    color: var(--text-main) !important;
    box-shadow: 0 0 6px rgba(214, 158, 46, 0.2);
}

.input-danger {
    border-color: var(--danger-border) !important;
    background: var(--danger-bg) !important;
    color: var(--text-main) !important;
    box-shadow: 0 0 6px rgba(229, 62, 62, 0.25);
}

.safe-limit-text {
    font-size: 10.5px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.safe-limit-text.safe { color: var(--safe-text); }
.safe-limit-text.caution { color: var(--caution-text); }
.safe-limit-text.danger { color: var(--danger-text); }

/* Buttons styling */
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #4a5568;
    box-shadow: none;
}

/* ====================================================================
   4. GUIDE SECTION
   ==================================================================== */
.guide-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .guide-grid {
        grid-template-columns: 1fr;
    }
}

.guide-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.guide-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 180, 216, 0.2);
    transform: translateY(-2px);
}

.guide-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.guide-card-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.guide-card-header .icon {
    font-size: 14px;
    color: var(--accent-blue);
}

.guide-ranges {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.range-badge {
    font-size: 10.5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.range-badge.safe { background: rgba(56, 161, 105, 0.12); color: var(--safe-text); }
.range-badge.caution { background: rgba(214, 158, 46, 0.12); color: var(--caution-text); }
.range-badge.danger { background: rgba(229, 62, 62, 0.12); color: var(--danger-text); }

.excel-shortcut-box {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.excel-shortcut-box h4 {
    font-size: 13px;
    color: var(--safe-text);
}

.excel-shortcut-box p.file-path {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    word-break: break-all;
    color: var(--text-muted);
}

/* ====================================================================
   5. ADMIN CONTROL PANEL STYLING
   ==================================================================== */
.admin-subform {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--divider-color);
    padding: 20px;
    border-radius: 12px;
}

.admin-subform h3 {
    font-size: 15px;
    color: var(--accent-blue);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tables styling */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-top: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: right;
}

.admin-table th {
    background: rgba(7, 19, 36, 0.8);
    color: var(--text-main);
    padding: 12px 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--divider-color);
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--divider-color);
    color: var(--text-muted);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table td .role-badge {
    display: inline-block;
}

/* Delete user button */
.delete-user-btn {
    background: rgba(229, 62, 62, 0.15);
    border: 1px solid rgba(229, 62, 62, 0.25);
    color: var(--danger-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-user-btn:hover {
    background: var(--danger-border);
    color: white;
}

/* ====================================================================
   6. AUDIT HISTORY TIMELINE (Audit Trail)
   ==================================================================== */
.audit-trail-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 480px;
    overflow-y: auto;
    padding-left: 5px;
}

.timeline-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px 18px;
    position: relative;
    border-right: 4px solid var(--primary-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.timeline-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.timeline-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--text-muted);
}

.timeline-item-header .date {
    font-weight: 600;
}

.timeline-item-header .type-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.type-badge.hatchery { background: var(--COLOR_HATCHERY, #008080); }
.type-badge.earthen { background: var(--COLOR_EARTHEN, #8b5a2b); }
.type-badge.marine { background: var(--COLOR_MARINE, #0f4c81); }

.timeline-item-body {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
}

.timeline-item-body span.highlight {
    color: var(--accent-blue);
}

.timeline-item-footer {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    word-break: break-all;
}

.timeline-item-footer i {
    color: var(--accent-blue);
    margin-left: 5px;
}

/* ====================================================================
   7. TOAST NOTIFICATIONS
   ==================================================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: #1a202c;
    border-right: 5px solid var(--safe-border);
    border-radius: 8px;
    padding: 15px 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(0);
}

.toast.hidden {
    opacity: 0;
    transform: translateY(100px);
    pointer-events: none;
}

.toast.toast-success { border-right-color: #38a169; }
.toast.toast-warning { border-right-color: #d69e2e; }
.toast.toast-error { border-right-color: #e53e3e; }

.feed-save-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.feed-save-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.feed-requests-body { padding: 0 4px 8px; }

.feed-req-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.feed-req-table th, .feed-req-table td { padding: 8px 10px; border-bottom: 1px solid var(--card-border); text-align: right; }
.feed-req-table th { font-size: 11px; color: var(--text-muted); }
.feed-req-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.success-icon {
    font-size: 28px;
    color: var(--safe-text);
}

.toast .message {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast .message .title {
    font-weight: 700;
    font-size: 14.5px;
}

.toast .message .text {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* User Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
}

.status-badge.online {
    background: rgba(56, 161, 105, 0.15);
    color: var(--safe-text);
    border-color: rgba(56, 161, 105, 0.2);
}

.status-badge.online i {
    color: #48bb78;
    font-size: 8px;
}

.status-badge.offline {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger-text);
    border-color: rgba(229, 62, 62, 0.15);
}

.status-badge.offline i {
    color: #e53e3e;
    font-size: 8px;
}

/* Green Pulsing dot animation for online status */
.pulse-green {
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    animation: pulse-green-anim 1.5s infinite;
    border-radius: 50%;
}

@keyframes pulse-green-anim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(72, 187, 120, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}
/* ====================================================================
   8. LIGHT MODE CUSTOM THEME & OVERRIDES
   ==================================================================== */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--accent-blue);
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 15px;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

body.light-mode {
    --bg-dark: #f0f4f8;
    --bg-gradient: linear-gradient(135deg, #eef2f7 0%, #dfe6ed 100%);
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-border: rgba(0, 0, 0, 0.08);
    --primary: #1a569b;
    --primary-light: #2b6cb0;
    --accent-blue: #0077b6;
    --text-main: #1a202c;
    --text-muted: #4a5568;
    --divider-color: rgba(0, 0, 0, 0.08);
    
    /* Alarm Fills for Light Mode */
    --safe-bg: rgba(56, 161, 105, 0.08);
    --safe-border: #38a169;
    --safe-text: #2f855a;

    --caution-bg: rgba(214, 158, 46, 0.08);
    --caution-border: #d69e2e;
    --caution-text: #b7791f;

    --danger-bg: rgba(229, 62, 62, 0.08);
    --danger-border: #e53e3e;
    --danger-text: #c53030;
}

body.light-mode .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #0077b6;
}

body.light-mode .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-mode select, 
body.light-mode input, 
body.light-mode textarea {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    color: #1a202c !important;
}

body.light-mode select option {
    background: #ffffff !important;
    color: #1a202c !important;
}

body.light-mode .user-badge {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #2d3748;
}

body.light-mode .excel-shortcut-box {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .admin-subform {
    background: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .timeline-item {
    background: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.04);
    border-right-color: var(--primary-light);
}

body.light-mode .timeline-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .timeline-item-footer {
    background: rgba(0, 0, 0, 0.03);
}

body.light-mode .admin-table th {
    background: rgba(220, 228, 238, 0.95);
    color: #1a202c;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .admin-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: #4a5568;
}

body.light-mode .admin-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

body.light-mode .guide-card {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.04);
}

body.light-mode .app-nav-hub {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .nav-tile--dashboard { color: #4338ca; }
body.light-mode .nav-tile--admin { color: #475569; }
body.light-mode .nav-tile--watch { color: #b91c1c; }
body.light-mode .nav-tile--hatchery { color: #6d28d9; }
body.light-mode .nav-tile--earthen { color: #b45309; }
body.light-mode .nav-tile--marine { color: #0f766e; }
body.light-mode .nav-tile--feed-wh { color: #c2410c; }
body.light-mode .nav-tile--feed { color: #15803d; }
body.light-mode .nav-tile--health { color: #b91c1c; }
body.light-mode .nav-tile--excel { color: #166534; }
body.light-mode .nav-tile--sync { color: #1d4ed8; }
body.light-mode .nav-tile--records { color: #334155; }
body.light-mode .nav-tile--kpi { color: #1d4ed8; }
body.light-mode .nav-tile--rehab { color: #0f766e; }
body.light-mode .nav-tile--overtime { color: #6d28d9; }

body.light-mode .nav-tile:hover,
body.light-mode .nav-tile.active {
    color: #0f172a;
}

body.light-mode .app-nav {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .nav-tab {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #4a5568;
}

body.light-mode .nav-tab:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a202c;
}

body.light-mode .nav-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-color: transparent;
}

body.light-mode .toast {
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    color: #1a202c;
    border-right: 5px solid #38a169;
}

body.light-mode .toast .message .text {
    color: #4a5568;
}

/* ─── Section reorganization styles ─── */
.field-group-block {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
}

.field-group-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cycle-field-hidden {
    display: none !important;
}

.cycle-operation-group {
    margin-bottom: 10px;
}

.cycle-operation-group select {
    width: 100%;
    max-width: 420px;
}

.fish-stock-box {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.section-info-box {
    padding: 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.2);
}

.section-info-box h4 {
    margin-bottom: 10px;
    font-size: 14px;
}

.permissions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.permissions-list i.fa-check { color: var(--safe-text); }
.permissions-list i.fa-xmark { color: var(--danger-text); }

.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.records-actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

.records-actions .filter-select {
    min-width: 128px;
    max-width: 180px;
}

.records-actions .btn {
    padding: 7px 12px;
    font-size: 12.5px;
}

@media (max-width: 860px) {
    .records-actions {
        flex-wrap: wrap;
        width: 100%;
    }
}

.filter-select {
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.3;
}

.btn-secondary {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid var(--card-border) !important;
    box-shadow: none !important;
}

.btn-excel-download {
    background: linear-gradient(135deg, #2b6cb0, #4299e1) !important;
    border: none !important;
}

.view-only-badge {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-btns {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.action-btns .edit-btn,
.action-btns .delete-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    font-size: 13px;
}

.action-btns .edit-btn { color: #3498db; border-color: rgba(52,152,219,0.3); }
.action-btns .delete-btn { color: #e74c3c; border-color: rgba(231,76,60,0.3); }

.summary-cell {
    font-size: 12px;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-cell, .empty-cell, .error-cell {
    text-align: center;
    padding: 25px !important;
    color: var(--text-muted);
}

.guide-card.mini {
    padding: 10px 12px;
}

.guide-card.mini h4 {
    font-size: 12px;
    margin-bottom: 4px;
}

.guide-card.mini p {
    font-size: 11px;
    color: var(--text-muted);
}

.compact-guide {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

body.light-mode .field-group-block {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .section-info-box {
    background: rgba(43, 108, 176, 0.06);
}

/* ─── Share link box ─── */
.share-link-box {
    padding: 16px;
    border-radius: 12px;
    background: rgba(43, 108, 176, 0.1);
    border: 1px solid rgba(66, 153, 225, 0.25);
    margin-bottom: 4px;
}

.share-link-box h3 {
    font-size: 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-light);
}

.share-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.6;
}

.share-warning-box {
    background: rgba(229, 62, 62, 0.12);
    border: 1px solid rgba(229, 62, 62, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--danger-text);
}

.share-warning-box code {
    background: rgba(0,0,0,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    direction: ltr;
    display: inline-block;
}

.share-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-top: 10px;
}

.share-label-engineer {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 13px;
}

.share-url-local {
    opacity: 0.7;
    margin-bottom: 4px;
}

.share-url-network {
    border-color: rgba(66, 153, 225, 0.5) !important;
    font-size: 15px !important;
}

.network-status {
    margin-top: 10px;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.network-status.loading {
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
}

.network-status.ok {
    color: var(--safe-text);
    background: rgba(56, 161, 105, 0.12);
    border: 1px solid rgba(56, 161, 105, 0.25);
}

.network-status.error {
    color: var(--danger-text);
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.25);
}

.manual-ip-box {
    margin-top: 14px;
    padding: 14px;
    border-radius: 10px;
    background: rgba(214, 158, 46, 0.08);
    border: 1px dashed rgba(214, 158, 46, 0.4);
}

.manual-ip-steps {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 10px;
}

.manual-ip-steps code {
    background: rgba(0,0,0,0.12);
    padding: 1px 5px;
    border-radius: 4px;
    direction: ltr;
    display: inline-block;
}

.share-link-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.share-url-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--accent-blue);
    font-family: 'Consolas', monospace;
    font-size: 14px;
    font-weight: 600;
    direction: ltr;
    text-align: left;
}

.btn-copy-link {
    white-space: nowrap;
    background: linear-gradient(135deg, #2b6cb0, #4299e1) !important;
}

.share-credentials-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.5;
}

.notify-phones-box {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    cursor: pointer;
}

.tg-discovered {
    margin-top: 8px;
}

.tg-discovered-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.12);
    border: 1px solid rgba(13, 148, 136, 0.28);
    font-size: 0.85rem;
}

.tg-recipients-head {
    margin: 14px 0 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

.tg-recipient {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tg-recipient-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tg-recipient-top .share-url-input {
    flex: 1 1 120px;
    min-width: 0;
}

.tg-types {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.tg-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
}

body.light-mode .tg-recipient {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .tg-type {
    color: #475569;
}

.team-phones-input {
    width: 100%;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

body.light-mode .team-phones-input {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a202c;
}

body.light-mode .share-link-box {
    background: rgba(43, 108, 176, 0.06);
}

body.light-mode .share-url-input {
    background: #fff;
    color: #2b6cb0;
}

/* ─── Admin panel layout — عمود واحد كامل (كل الأقسام تظهر بالتتابع) ─── */
#viewAdminPanel.app-workspace.tab-view.active,
.admin-panel-layout.active {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: 1fr !important;
    gap: 14px;
    width: 100%;
}

.admin-panel-layout {
    /* يُعرَض كعمود واحد — لا تقسيم لعمودين */
}

.admin-full-card {
    max-height: none;
    overflow: visible;
    width: 100%;
}

.users-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.users-list-header h3 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-blue);
}

.users-table-wrapper {
    max-height: min(480px, 55vh);
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 10px;
}

.btn-sm {
    padding: 6px 14px !important;
    font-size: 12px !important;
}

.btn-add-user {
    margin-top: 12px;
    width: 100%;
    justify-content: center;
    font-size: 15px;
    padding: 12px 20px !important;
}

.protected-badge {
    font-size: 12px;
    color: var(--safe-text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.delete-user-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(231, 76, 60, 0.4);
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.delete-user-btn:hover {
    background: rgba(231, 76, 60, 0.25);
}

.user-action-btns {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.copy-user-msg-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(37, 211, 102, 0.4);
    background: rgba(37, 211, 102, 0.12);
    color: #25d366;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.copy-user-msg-btn:hover {
    background: rgba(37, 211, 102, 0.22);
}

.excel-central-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: rgba(16, 124, 65, 0.1);
    border: 1px solid rgba(16, 124, 65, 0.25);
}

.excel-central-banner i {
    font-size: 18px;
    color: #107c41;
    margin-top: 2px;
    flex-shrink: 0;
}

.excel-central-banner strong {
    display: block;
    margin-bottom: 2px;
    color: #107c41;
    font-size: 13px;
}

.excel-central-banner p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

@media (max-width: 1100px) {
    .header-top-row {
        flex-wrap: wrap;
    }
}

/* ====================================================================
   لوحة المزرعة — سجل الأحواض والأقفاص
   ==================================================================== */
.dashboard-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-card .kpi-label {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-card .kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-card .kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.kpi-card.highlight-green { border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }
.kpi-card.highlight-blue { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.08); }
.kpi-card.highlight-amber { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.kpi-card.highlight-purple { border-color: rgba(168, 85, 247, 0.4); background: rgba(168, 85, 247, 0.08); }

.dashboard-section-block {
    margin-bottom: 24px;
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dashboard-section-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-section-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-section-stats span {
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
}

.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
    padding: 4px 2px 8px;
}

.unit-card {
    border: none;
    border-radius: 12px;
    padding: 12px 8px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    text-align: center;
    min-height: 94px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    position: relative;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    box-shadow:
        0 4px 0 rgba(0, 0, 0, 0.22),
        0 6px 14px rgba(0, 0, 0, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -3px 6px rgba(0, 0, 0, 0.12);
}

.unit-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(160deg, rgba(255,255,255,0.18) 0%, transparent 45%);
    pointer-events: none;
}

.unit-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 6px 0 rgba(0, 0, 0, 0.18),
        0 12px 22px rgba(0, 0, 0, 0.32),
        inset 0 2px 0 rgba(255, 255, 255, 0.32),
        inset 0 -3px 6px rgba(0, 0, 0, 0.1);
}

.unit-card:active {
    transform: translateY(1px);
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.22),
        0 4px 10px rgba(0, 0, 0, 0.22),
        inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.unit-card.status-empty {
    background: linear-gradient(145deg, #94a3b8 0%, #64748b 55%, #475569 100%);
    color: #f8fafc;
}

.unit-card.status-stocked {
    background: linear-gradient(145deg, #60a5fa 0%, #3b82f6 55%, #1d4ed8 100%);
}

.unit-card.status-growing {
    background: linear-gradient(145deg, #4ade80 0%, #22c55e 55%, #15803d 100%);
}

.unit-card.status-harvest {
    background: linear-gradient(145deg, #c084fc 0%, #a855f7 55%, #7e22ce 100%);
}

.unit-card.status-maintenance {
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 55%, #b45309 100%);
    color: #1a1a1a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.unit-card.status-disabled {
    background: linear-gradient(145deg, #f87171 0%, #ef4444 55%, #b91c1c 100%);
}

.unit-card .unit-num {
    font-size: 13px;
    font-weight: 800;
    opacity: 1;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

.unit-card .unit-status {
    font-size: 12px;
    font-weight: 700;
    opacity: 1;
    position: relative;
    z-index: 1;
}

.pond-usage-group .pond-usage-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted, #64748b);
    line-height: 1.35;
}

.pond-usage-group label small {
    font-weight: 400;
    opacity: 0.85;
}

.pond-usage-select:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.unit-card .unit-usage {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.92;
    position: relative;
    z-index: 1;
    line-height: 1.2;
}

.unit-card .unit-usage-warn {
    color: #fef3c7;
    background: rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    padding: 1px 4px;
}

.unit-card .unit-fish {
    font-size: 11px;
    font-weight: 600;
    opacity: 1;
    line-height: 1.3;
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.18);
    padding: 2px 8px;
    border-radius: 10px;
}

.unit-card.status-maintenance .unit-fish {
    background: rgba(255, 255, 255, 0.35);
}

.unit-card.stale {
    outline: 2px dashed #fbbf24;
    outline-offset: 3px;
}

.unit-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: auto;
    backdrop-filter: blur(12px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 { font-size: 16px; }

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-body {
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-detail-item.full { grid-column: 1 / -1; }

.modal-detail-item label {
    font-size: 11px;
    color: var(--text-muted);
}

.modal-detail-item span {
    font-size: 14px;
    font-weight: 600;
}

.modal-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.registry-edit-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.registry-edit-form .form-group.full { grid-column: 1 / -1; }

.registry-maintenance-banner,
.registry-maintenance-hint {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.registry-maintenance-banner {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.registry-maintenance-hint {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--text-muted);
}

.registry-maintenance-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.registry-btn-maintenance {
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.registry-edit-form label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.registry-edit-form input,
.registry-edit-form select,
.registry-edit-form textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: inherit;
}

.unit-info-banner {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    display: none;
}

.unit-info-banner.visible { display: block; }

.excel-fix-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    flex-wrap: wrap;
}

.excel-fix-banner i {
    color: #f59e0b;
    font-size: 20px;
    margin-top: 2px;
}

.excel-fix-banner strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.excel-fix-banner p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.excel-files-guide {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(16, 124, 65, 0.08);
    border: 1px solid rgba(16, 124, 65, 0.25);
    font-size: 12px;
    color: var(--text-muted);
}

.excel-files-guide strong {
    display: block;
    color: #107c41;
    margin-bottom: 8px;
}

.excel-files-guide ul {
    margin: 0 0 10px 0;
    padding-right: 18px;
    line-height: 1.6;
}

.excel-open-grid {
    grid-template-columns: repeat(3, 1fr) !important;
}

.registry-open-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.registry-open-box.excel-shortcut-box {
    padding: 10px;
    margin-top: 0;
}

.registry-open-btn {
    width: 100%;
    background: linear-gradient(135deg, #107c41, #1f9a55) !important;
    font-size: 11.5px;
    padding: 7px 6px;
    min-height: 0;
    box-shadow: none !important;
    border-radius: 8px;
    line-height: 1.25;
    justify-content: center;
    gap: 5px;
}

.registry-open-btn i {
    font-size: 10px;
    flex-shrink: 0;
}

.dashboard-toolbar .btn-excel-download {
    font-size: 12px;
    padding: 8px 12px;
}

body.light-mode .unit-card { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
body.light-mode .unit-card.status-maintenance { color: #1a1a1a; text-shadow: 0 1px 0 rgba(255,255,255,0.4); }

/* ─── أبعاد الحوض وحجم المياه ─── */
.pond-volume-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 180, 216, 0.12);
    border: 1px solid rgba(0, 180, 216, 0.35);
}

.pond-volume-box > i {
    font-size: 22px;
    color: var(--accent-blue);
    margin-top: 2px;
}

.pond-volume-box strong {
    display: block;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.pond-volume-box p {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.pond-volume-box small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 11px;
}

.pond-volume-box .vol-sep {
    margin: 0 8px;
    color: var(--text-muted);
}

.pond-dims-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(59, 130, 246, 0.08));
    border: 1px solid rgba(14, 165, 233, 0.25);
    color: #0c4a6e;
    font-size: 0.92rem;
    line-height: 1.5;
}

.pond-dims-hint i {
    color: #0284c7;
    margin-top: 2px;
}

.pond-dims-hint strong {
    color: #0369a1;
}

.backup-status-box {
    margin-bottom: 12px;
}

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

.backup-stat {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
}

.backup-stat.ok {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}

.backup-stat.warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}

.backup-stat strong {
    display: block;
    margin-bottom: 4px;
}

.backup-stat span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.backup-bridge-ok {
    color: #15803d;
    font-weight: 600;
}

.backup-bridge-warn {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: var(--text-primary);
}

.backup-bridge-warn i {
    color: #3b82f6;
    font-size: 1.25rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.backup-bridge-warn strong {
    display: block;
    margin-bottom: 6px;
}

.backup-bridge-warn p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.backup-bridge-warn code {
    font-size: 0.85rem;
}

.backup-bridge-warn.backup-auto-ok {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.4);
}

.backup-bridge-warn.backup-auto-ok i {
    color: #16a34a;
}

.backup-external-form.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.backup-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.backup-hint {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 12px;
}

.backup-list-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.backup-restore-btn {
    border-color: rgba(245, 158, 11, 0.45) !important;
    color: #fbbf24 !important;
}

.backup-restore-warn {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text-primary);
}

.backup-restore-warn i {
    color: #f59e0b;
    font-size: 1.25rem;
    margin-top: 2px;
}

.backup-restore-warn p {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.backup-restore-preview {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.backup-restore-confirm {
    margin-top: 12px;
}

.backup-external-status {
    margin-bottom: 14px;
}

.backup-external-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.admin-external-backup-card {
    border-color: rgba(59, 130, 246, 0.25);
}

.backup-reminder-banner {
    margin: 0 0 10px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(234, 88, 12, 0.08));
}

.backup-reminder-banner.level-urgent {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.1));
}

.backup-reminder-banner.level-warn {
    border-color: rgba(245, 158, 11, 0.45);
}

.backup-reminder-banner.level-info {
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.04));
}

.backup-reminder-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.backup-reminder-icon {
    font-size: 1.2rem;
    color: #fbbf24;
}

.backup-reminder-text-wrap {
    flex: 1;
    min-width: 200px;
}

.backup-reminder-text-wrap strong {
    display: block;
    margin-bottom: 2px;
}

.backup-reminder-text-wrap span {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.backup-reminder-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.backup-reminder-panel {
    margin-bottom: 16px;
}

.backup-reminder-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.backup-reminder-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.backup-reminder-item.urgent { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.06); }
.backup-reminder-item.warn { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.06); }
.backup-reminder-item.ok { border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.06); }
.backup-reminder-item.info { border-color: rgba(59, 130, 246, 0.35); }

.backup-reminder-item i { margin-top: 3px; }
.backup-reminder-item strong { display: block; margin-bottom: 4px; }
.backup-reminder-item p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

.backup-schedule-box {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.backup-schedule-box ul {
    margin: 8px 0 0;
    padding-right: 18px;
}

.backup-contents-panel {
    margin-top: 8px;
}

.backup-contents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.backup-contents-card {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.backup-contents-card h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.backup-contents-card .sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.backup-contents-card ul {
    margin: 8px 0;
    padding-right: 18px;
    font-size: 0.88rem;
}

.backup-contents-card ul.inc li { color: var(--text-primary); }
.backup-contents-card ul.exc li { color: var(--text-muted); }

.backup-contents-summary {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-size: 0.9rem;
}

.backup-excel-toggle {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--accent);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    text-decoration: underline;
}

.admin-backup-schedule-card {
    border-color: rgba(245, 158, 11, 0.2);
}

.backup-drive-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    margin-inline-start: 6px;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.backup-drive-badge.system {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.overtime-excel-btn {
    background: linear-gradient(135deg, #ea580c, #c2410c) !important;
    border-color: #c2410c !important;
}

#viewOvertimePanel {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 18px;
    align-items: start;
}

@media (max-width: 1100px) {
    #viewOvertimePanel { grid-template-columns: 1fr; }
}

.ot-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ot-summary-card {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(234, 88, 12, 0.08);
}

.ot-summary-card strong { display: block; margin-bottom: 4px; }
.ot-hours-total { color: #ea580c; font-weight: 700; font-size: 1.1rem; }

.overtime-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

/* ─── الأوفر تايم: إخفاء ورقة الطباعة عن الشاشة — وإخفاء الواجهة عند الطباعة ─── */
@media screen {
    #overtimePrintSheet,
    .overtime-print-sheet {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        top: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }
}

@media print {
    body.printing-overtime > *:not(#overtimePrintSheet) {
        display: none !important;
        visibility: hidden !important;
    }

    body.printing-overtime #overtimePrintSheet,
    body.printing-overtime .overtime-print-sheet {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
        color: #000 !important;
        pointer-events: auto !important;
    }
}

body.light-mode .kpi-card { background: rgba(255, 255, 255, 0.85); }
body.light-mode .modal-card { background: #fff; }

.permissions-panel {
    margin: 14px 0 18px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(15, 23, 42, 0.45);
}

.permissions-panel h4 {
    margin: 0 0 6px;
    font-size: 15px;
}

.permissions-hint {
    margin: 0 0 14px;
    font-size: 12px;
    opacity: 0.75;
}

.permissions-block {
    margin-bottom: 14px;
}

.permissions-block-title {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
}

.permissions-grid-files {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.perm-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.perm-check input { accent-color: #6366f1; }

.perm-check.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.role-badge.manager {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e3a8a;
    border: 1px solid #93c5fd;
}

.perm-summary {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.5;
}

body.light-mode .permissions-panel {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .perm-check {
    background: #fff;
    border-color: #e2e8f0;
}

#recordsExcelGrid,
#excelFilesGrid {
    margin: 8px 0 12px;
}

#excelFilesGrid .registry-open-btn,
#recordsExcelGrid .registry-open-btn {
    min-height: 0;
    font-size: 11.5px;
    font-weight: 600;
    padding: 7px 6px;
    border-radius: 8px;
}

#excelFilesGrid .registry-open-btn:hover,
#recordsExcelGrid .registry-open-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 124, 65, 0.28) !important;
}

.excel-open-hint {
    margin-top: 14px;
    font-size: 12px;
    opacity: 0.75;
    text-align: center;
}

.excel-viewer-modal {
    max-width: min(96vw, 1200px);
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.excel-viewer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--card-border);
    font-size: 12px;
    color: var(--text-muted);
}

.excel-viewer-filename {
    font-weight: 600;
    color: var(--text-main);
}

.excel-view-only-badge {
    margin-inline-start: auto;
    background: rgba(16, 124, 65, 0.15);
    color: #48bb78;
    border: 1px solid rgba(16, 124, 65, 0.3);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.excel-viewer-table-wrap {
    flex: 1;
    overflow: auto;
    margin: 0;
    max-height: calc(92vh - 120px);
    padding: 0 12px 14px;
}

.excel-preview-table {
    width: 100%;
    min-width: 640px;
    font-size: 12px;
}

.excel-preview-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(16, 124, 65, 0.25);
    white-space: nowrap;
}

.excel-preview-table td {
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.excel-preview-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

body.light-mode .excel-preview-table th {
    background: rgba(16, 124, 65, 0.12);
}

body.light-mode .excel-view-only-badge {
    background: rgba(16, 124, 65, 0.1);
    color: #166534;
}

.sync-files-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.sync-file-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.sync-file-card h4 {
    margin: 0 0 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-file-meta {
    font-size: 11.5px;
    color: var(--text-muted);
}

.sync-file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.sync-file-actions .btn {
    font-size: 11.5px;
    padding: 7px 11px;
}

.sync-compare-modal {
    max-width: min(96vw, 640px);
}

.sync-compare-body {
    padding: 16px 18px;
    display: block;
}

.sync-compare-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.sync-stat-box {
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sync-stat-box strong {
    display: block;
    font-size: 22px;
    margin-bottom: 4px;
}

.sync-stat-box span {
    font-size: 11px;
    color: var(--text-muted);
}

.sync-stat-box.new strong { color: #48bb78; }
.sync-stat-box.update strong { color: #ecc94b; }
.sync-stat-box.same strong { color: var(--accent-blue); }

.sync-compare-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--card-border);
}

body.light-mode .sync-file-card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

@media (max-width: 700px) {
    .sync-file-card { grid-template-columns: 1fr; }
    .sync-file-actions { justify-content: flex-start; }
    .sync-compare-stats { grid-template-columns: 1fr; }
}

.connection-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.connection-status-bar.online {
    background: rgba(72, 187, 120, 0.12);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: #48bb78;
}

.connection-status-bar.offline {
    background: rgba(229, 62, 62, 0.12);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: #fc8181;
}

.connection-status-bar.queued {
    background: rgba(214, 158, 46, 0.12);
    border: 1px solid rgba(214, 158, 46, 0.3);
    color: #ecc94b;
}

.offline-guide-box {
    margin: 12px 0 16px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(66, 153, 225, 0.25);
    background: rgba(66, 153, 225, 0.08);
}

.offline-guide-box h4 {
    margin: 0 0 10px;
    font-size: 14px;
}

.offline-guide-box ul {
    margin: 0;
    padding-right: 18px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-muted);
}

.offline-queue-box {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(214, 158, 46, 0.35);
    background: rgba(214, 158, 46, 0.08);
}

.offline-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
}

.offline-queue-list {
    margin: 0;
    padding-right: 18px;
    font-size: 12px;
    color: var(--text-muted);
    max-height: 120px;
    overflow-y: auto;
}

.btn-sm { font-size: 11.5px; padding: 6px 10px; }

.edit-user-modal {
    max-width: 720px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.modal-header h3 { margin: 0; }

.edit-user-btn {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

@media (max-width: 1100px) {
    .logo-area p { display: none; }
    .nav-tab { padding: 6px 11px; font-size: 12px; }
}

@media (max-width: 860px) {
    .nav-tab:not(.nav-tile) span { display: none; }
    .nav-tab:not(.nav-tile) { padding: 8px 11px; }
    .nav-tab:not(.nav-tile).active span { display: inline; }
}

@media (max-width: 640px) {
    .app-header { padding: 12px 14px 14px; }
    .header-top-row { flex-wrap: wrap; }
    .header-actions { margin-inline-start: auto; }
    .user-badge { max-width: 200px; }
}

@media (max-width: 900px) {
    .excel-open-grid,
    .registry-open-box {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 700px) {
    .modal-body { grid-template-columns: 1fr; }
    .registry-open-box,
    .excel-open-grid { grid-template-columns: 1fr !important; }
    .unit-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .permissions-grid,
    .permissions-grid-files { grid-template-columns: 1fr; }
    .logo-area h1 { font-size: 15px; }
    .nav-hub-row--primary,
    .nav-hub-row--mgmt {
        grid-template-columns: 1fr 1fr;
    }
    .nav-hub-row--ops,
    .nav-hub-row--tools {
        grid-template-columns: repeat(2, 1fr);
    }
    .nav-tile {
        min-height: 68px;
        font-size: 11.5px;
        padding: 10px 8px;
    }
    .nav-tile i { font-size: 17px; }
}

/* ─── عرض السجلات — المرحلة 1 (إضافات دون تغيير التصميم الأساسي) ─── */
.records-attention-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: var(--caution-bg);
    border: 1px solid rgba(214, 158, 46, 0.35);
    font-size: 13px;
    line-height: 1.55;
}

.records-attention-banner > i {
    color: var(--caution-text);
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.records-attention-banner strong {
    display: block;
    color: var(--caution-text);
    margin-bottom: 4px;
}

.records-attention-banner p {
    margin: 0;
    color: var(--text-muted);
}

.records-attention-list {
    margin: 6px 0 0;
    padding: 0 18px 0 0;
    color: var(--text-main);
}

.records-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    margin-bottom: 8px;
}

.records-search-input {
    flex: 1 1 auto;
    min-width: 0;
}

.records-filter-row .filter-select {
    flex: 0 0 auto;
    min-width: 132px;
}

.records-filter-row .btn-sm {
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .records-filter-row {
        flex-wrap: wrap;
    }

    .records-filter-row .filter-select {
        flex: 1 1 140px;
    }
}

.records-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.88rem;
    color: var(--text-muted);
}

.records-stats-bar strong {
    color: var(--text-primary);
}

.records-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.records-pagination .records-page-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    min-width: 140px;
    text-align: center;
}

.records-table tr.records-date-header td {
    background: rgba(59, 130, 246, 0.1);
    border-top: 2px solid rgba(59, 130, 246, 0.25);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.records-table tr.records-date-header td span {
    color: var(--text-muted);
    font-weight: normal;
    margin-inline-start: 8px;
}

.records-table-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.records-table tbody tr.record-row-clickable {
    cursor: pointer;
}

.records-table tbody tr.record-row-clickable:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.records-table tbody tr.row-wq-caution td {
    background: var(--caution-bg);
}

.records-table tbody tr.row-wq-danger td {
    background: var(--danger-bg);
}

.records-table tbody tr.row-wq-caution:hover td,
.records-table tbody tr.row-wq-danger:hover td {
    filter: brightness(1.08);
}

.summary-cell .wq-inline {
    white-space: nowrap;
}

.summary-cell .wq-inline-caution {
    color: var(--caution-text);
    font-weight: 600;
}

.summary-cell .wq-inline-danger {
    color: var(--danger-text);
    font-weight: 600;
}

.summary-cell .wq-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

.record-modal-alerts {
    margin: 0 18px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.record-modal-alerts.alert-caution {
    background: var(--caution-bg);
    border: 1px solid rgba(214, 158, 46, 0.35);
    color: var(--caution-text);
}

.record-modal-alerts.alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(229, 62, 62, 0.35);
    color: var(--danger-text);
}

.modal-detail-item .detail-safe { color: var(--safe-text); }
.modal-detail-item .detail-caution { color: var(--caution-text); }
.modal-detail-item .detail-danger { color: var(--danger-text); }

.record-detail-modal .modal-body {
    max-height: 55vh;
    overflow-y: auto;
}

body.light-mode .records-table tbody tr.record-row-clickable:hover td {
    background: rgba(0, 0, 0, 0.03);
}

/* ——— ألوان الإشغال على بطاقات اللوحة ——— */
.unit-card.unit-card-by-usage {
    background: linear-gradient(160deg, var(--u-light) 0%, var(--u-base) 55%, var(--u-dark) 100%);
}

.unit-card.unit-card-by-usage.usage-tone-light {
    color: #0f172a;
    text-shadow: none;
}

.usage-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
}

.usage-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.usage-legend-item::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--chip);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.brand-logo {
    height: 42px;
    width: auto;
    max-width: 118px;
    object-fit: contain;
    flex-shrink: 0;
}

.login-brand-logo {
    width: min(220px, 72vw);
    height: auto;
    max-height: 88px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

.dashboard-tasks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.dashboard-tasks-head h4 {
    margin: 0;
}

.dashboard-tasks-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cage-groups-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cage-group-block {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.cage-group-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.cage-group-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

.cage-group-chip {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--group-color, #0891b2);
}

.cage-group-size {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.cage-group-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.registry-dims-locked-note,
.registry-dims-admin-note {
    grid-column: 1 / -1;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.registry-dims-locked-note {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted, #64748b);
}

.registry-dims-admin-note {
    background: rgba(59, 130, 246, 0.1);
    color: #0369a1;
}

.dim-field-locked {
    opacity: 0.72;
    cursor: not-allowed;
    background: rgba(148, 163, 184, 0.12) !important;
}

/* ——— سجل الوحدة الكامل ——— */
.unit-history-overlay {
    z-index: 100001;
}

.unit-history-modal {
    max-width: 780px;
}

.unit-history-launch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.unit-history-launch-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.unit-history-summary {
    padding: 0 18px 12px;
}

.unit-history-date-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: rgba(14, 116, 144, 0.12);
    border: 1px solid rgba(14, 116, 144, 0.25);
    border-radius: 10px;
    font-size: 0.9rem;
}

.unit-history-date-range strong {
    font-size: 1rem;
}

.unit-history-date-label {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.unit-history-date-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

.unit-history-date-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-inline-start: auto;
}

.unit-history-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.unit-history-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
}

.unit-history-stat span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.unit-history-stat strong {
    font-size: 0.9rem;
}

.unit-history-filters {
    padding: 0 18px 12px;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
    border-bottom: 1px solid var(--card-border);
}

.unit-history-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.unit-history-filter-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
}

.unit-history-print-btn {
    white-space: nowrap;
}

.unit-history-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.unit-history-tab {
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.82rem;
    cursor: pointer;
}

.unit-history-tab.active {
    background: var(--accent, #3b82f6);
    border-color: transparent;
    color: #fff;
}

.unit-history-cycle-select {
    min-width: 180px;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg, rgba(0, 0, 0, 0.2));
    color: var(--text-primary);
}

.unit-history-body {
    padding: 12px 18px 18px;
    max-height: 52vh;
    overflow-y: auto;
}

.unit-history-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unit-history-day {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
}

.unit-history-day-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.unit-history-day-head time {
    font-weight: 700;
    font-size: 0.95rem;
}

.unit-history-cycle-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.unit-history-operator {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-inline-start: auto;
}

.unit-history-events {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.unit-history-event {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.15);
}

.unit-history-event-cycleStart {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.unit-history-event-cycleEnd {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.unit-history-event-stocking {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

.unit-history-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
}

.unit-history-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.unit-history-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.unit-history-field {
    font-size: 0.82rem;
}

.unit-history-field strong {
    font-weight: 600;
    color: var(--text-muted);
}

.unit-history-feed-line {
    font-size: 0.82rem;
    margin-top: 4px;
}

.unit-history-notes {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.unit-history-loading,
.unit-history-empty,
.unit-history-error {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
}

.unit-history-error {
    color: #f87171;
}

.unit-history-growth-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unit-history-growth-note {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
}

.unit-history-growth-chart {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 12px 6px;
    background: linear-gradient(180deg, rgba(14, 116, 144, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.unit-history-growth-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.unit-history-growth-trend {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.unit-history-growth-trend.up {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}

.unit-history-growth-trend.down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.unit-history-growth-trend.flat {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.growth-curve-svg {
    width: 100%;
    height: auto;
    display: block;
}

.growth-grid-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.growth-axis-label,
.growth-axis-title {
    fill: var(--text-muted);
    font-size: 11px;
}

.growth-area {
    fill: rgba(34, 211, 238, 0.18);
}

.growth-line {
    fill: none;
    stroke: #22d3ee;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.growth-point {
    fill: #0e7490;
    stroke: #67e8f9;
    stroke-width: 2;
}

.growth-zero-line {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
}

.growth-empty-label {
    fill: var(--text-muted);
    font-size: 13px;
}

.unit-history-growth-chart-empty {
    opacity: 0.85;
}

.unit-history-feed-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unit-history-feed-chart {
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.feed-line {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feed-area {
    fill: rgba(245, 158, 11, 0.18);
}

.feed-point {
    fill: #b45309;
    stroke: #fcd34d;
    stroke-width: 2;
}

.unit-history-feed-times {
    font-size: 0.78rem;
    white-space: normal;
    min-width: 120px;
}

.unit-history-feed-table th:last-child,
.unit-history-feed-table td:last-child {
    text-align: right;
}

.unit-history-water-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unit-history-water-table-wrap {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow-x: auto;
}

.unit-history-water-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.unit-history-water-table th,
.unit-history-water-table td {
    padding: 9px 10px;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.unit-history-water-table th {
    background: rgba(14, 116, 144, 0.12);
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.unit-history-water-table th:first-child,
.unit-history-water-table td.unit-history-water-date {
    text-align: right;
    font-weight: 600;
}

.unit-history-water-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.unit-history-water-table tr:last-child td {
    border-bottom: none;
}

.unit-history-notes-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unit-history-notes-table th:nth-child(2),
.unit-history-notes-table td.unit-history-note-cell {
    min-width: 220px;
}

.unit-history-note-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.unit-history-note-type {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    padding: 2px 8px;
}

.unit-history-note-text {
    color: var(--text-primary, #e2e8f0);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.unit-history-growth-table-wrap {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
}

.unit-history-growth-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.unit-history-growth-table th,
.unit-history-growth-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--card-border);
}

.unit-history-growth-table th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-weight: 600;
}

/* ─── الجولة الميدانية ─────────────────────────────────────────────── */
.nav-tile--field {
    background: linear-gradient(145deg, #0ea5e9 0%, #0284c7 55%, #0369a1 100%);
    border-color: rgba(14, 165, 233, 0.45);
}

.section-field-tour-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    margin: 0 0 14px;
    border-radius: 10px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.28);
}

.section-field-tour-banner i {
    color: #0ea5e9;
    font-size: 18px;
    margin-top: 2px;
}

.section-field-tour-banner strong {
    font-size: 13px;
}

.section-field-tour-banner .link-btn {
    background: none;
    border: none;
    color: #0284c7;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}

.field-sheet-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.field-sheet-card {
    overflow: visible;
    width: 100%;
    max-width: 100%;
    padding: 20px 22px;
    gap: 14px;
}

.field-sheet-mode-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0;
    border-bottom: 1px solid var(--border-subtle, #e2e8f0);
    margin-bottom: 0.5rem;
}

.field-sheet-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border-subtle, #cbd5e1);
    border-radius: 0.5rem 0.5rem 0 0;
    background: var(--surface-muted, #f8fafc);
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.field-sheet-mode-tab:hover {
    background: var(--surface-hover, #f1f5f9);
    color: var(--text-primary, #0f172a);
}

.field-sheet-mode-tab.active {
    background: var(--surface-card, #fff);
    color: var(--accent-teal, #0f766e);
    border-bottom-color: var(--surface-card, #fff);
    margin-bottom: -1px;
}

.field-sheet-info-banner--weight {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-color: #6ee7b7;
}

body:not(.light-mode) .field-sheet-mode-tab {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.25);
    color: #94a3b8;
}

body:not(.light-mode) .field-sheet-mode-tab.active {
    background: rgba(15, 23, 42, 0.95);
    color: #5eead4;
    border-color: rgba(94, 234, 212, 0.35);
}

body:not(.light-mode) .field-sheet-info-banner--weight {
    background: rgba(5, 150, 105, 0.12);
    border-color: rgba(52, 211, 153, 0.35);
}

.field-sheet-card .card-header {
    padding-bottom: 12px;
    margin-bottom: 0;
}

.field-sheet-card .card-header h2 {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.field-sheet-subtitle {
    font-size: 12px !important;
    margin: 0 !important;
    opacity: 0.85;
}

.field-sheet-info-banner--compact {
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.4;
    gap: 10px;
}

.field-sheet-info-banner--compact i {
    font-size: 16px;
    margin-top: 0;
}

.field-sheet-info-banner--compact span {
    flex: 1;
}

.field-sheet-steps--compact {
    margin-bottom: 10px;
    gap: 10px;
}

.field-sheet-steps--compact .field-sheet-step {
    padding: 8px 12px;
    font-size: 13px;
    gap: 8px;
    min-width: 120px;
}

.field-sheet-steps--compact .field-sheet-step span {
    width: 22px;
    height: 22px;
    font-size: 11px;
}

.field-sheet-toolbar--compact {
    gap: 12px;
    margin-bottom: 8px;
}

.field-sheet-toolbar--compact .form-group {
    min-width: 140px;
}

.field-sheet-toolbar--compact .form-group label {
    font-size: 12px;
    margin-bottom: 4px;
}

.filter-select-sm {
    padding: 7px 10px !important;
    font-size: 13px !important;
    min-height: 36px;
}

.field-sheet-hint-compact {
    margin: 0 0 10px !important;
    font-size: 12px !important;
    line-height: 1.35;
}

.field-sheet-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: min(62vh, 680px);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.field-sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.field-sheet-table th,
.field-sheet-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--card-border);
    text-align: center;
    vertical-align: middle;
}

.field-sheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0f766e;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
    padding: 7px 6px;
}

.field-sheet-table tr.row-skip td {
    background: rgba(245, 158, 11, 0.08);
}

.field-sheet-table td.unit-id {
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
}

.field-sheet-table td.status-cell {
    font-size: 11px;
    white-space: nowrap;
}

.field-sheet-table td.field-sheet-readonly {
    background: rgba(148, 163, 184, 0.12);
    font-weight: 700;
    font-size: 12px;
    color: #334155;
}

.field-sheet-table input::placeholder {
    color: #94a3b8;
    font-size: 11px;
}

.field-sheet-table input,
.field-sheet-table textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 5px 7px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: var(--input-bg, rgba(0, 0, 0, 0.2));
    color: inherit;
    font-size: 12px;
    box-sizing: border-box;
}

.field-sheet-table textarea {
    min-height: 28px;
    max-height: 48px;
    resize: vertical;
    line-height: 1.3;
}

.field-sheet-table .col-unit { width: 5.5%; }
.field-sheet-table .col-status { width: 6.5%; }
.field-sheet-table .col-num { width: 6.8%; }
.field-sheet-table .col-readonly { width: 6.2%; }
.field-sheet-table .col-notes { width: 11%; }

.field-sheet-info-banner i {
    color: #22c55e;
    font-size: 20px;
    margin-top: 2px;
}

.field-sheet-info-banner strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.field-sheet-info-banner p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.field-sheet-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px;
}

.field-sheet-step {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.field-sheet-step span {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #0284c7;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.field-sheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.field-sheet-toolbar .form-group {
    margin: 0;
    min-width: 160px;
}

.field-sheet-toolbar .form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.field-sheet-import-btn {
    cursor: pointer;
    margin: 0;
}

.field-sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.field-sheet-overwrite {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.field-sheet-result {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.field-sheet-result.has-errors {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
}

.unit-history-growth-table tr:last-child td {
    border-bottom: none;
}

.larvae-hidden-field {
    display: none !important;
}

.field-sheet-larvae-skip {
    color: var(--text-muted, #94a3b8);
    background: rgba(148, 163, 184, 0.08);
    text-align: center;
    font-size: 0.9em;
}

.field-sheet-weight-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #b91c1c;
    font-size: 0.82rem;
    line-height: 1.45;
}

.field-sheet-weight-alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

.field-sheet-weight-overdue-row td {
    background: rgba(254, 226, 226, 0.35);
}

.field-sheet-weight-overdue-input {
    border-color: #f87171 !important;
    background: #fff7f7 !important;
}

body:not(.light-mode) .field-sheet-weight-alert {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.field-sheet-table .col-sub-hint {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    opacity: 0.75;
}

.field-sheet-table th.col-feed-weight {
    background: #047857;
    color: #fff;
    box-shadow: inset 0 -3px 0 #6ee7b7;
}

.field-sheet-table th.col-feed-weight .col-sub-hint {
    color: #d1fae5;
    opacity: 1;
}

body:not(.light-mode) .field-sheet-table th.col-feed-weight {
    background: #059669;
    color: #f0fdfa;
    box-shadow: inset 0 -3px 0 #34d399;
}

.field-sheet-table .field-sheet-reference-input {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
}

.field-sheet-table .field-sheet-reference-input::placeholder {
    color: #94a3b8;
    font-size: 0.85em;
}

body:not(.light-mode) .field-sheet-table .field-sheet-reference-input {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}

.field-sheet-weight-guide {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #047857;
    font-size: 0.82rem;
    line-height: 1.45;
}

.field-sheet-sample-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(100, 116, 139, 0.35);
    background: rgba(248, 250, 252, 0.8);
}

.field-sheet-sample-toggle input {
    accent-color: #059669;
}

body:not(.light-mode) .field-sheet-weight-guide {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

body:not(.light-mode) .field-sheet-sample-toggle {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.5);
}

.field-sheet-registry-avg {
    font-weight: 700;
    color: #047857;
    background: rgba(16, 185, 129, 0.1) !important;
}

.col-date-readonly {
    font-size: 0.78rem;
    white-space: nowrap;
}

body:not(.light-mode) .field-sheet-registry-avg {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.14) !important;
}

.unit-history-larvae-note {
    margin: 0.5rem 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #166534;
    font-size: 0.92rem;
}

/* ── سجل نشاط المستخدمين (Audit) ── */
.security-audit-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}
.security-audit-filters .form-input { flex: 1 1 200px; min-width: 140px; }
.security-audit-filters #auditCategory { flex: 0 1 220px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#securityAuditTable { width: 100%; min-width: 720px; }
#securityAuditTable td { vertical-align: middle; }
.audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-cat { color: var(--muted, #64748b); font-size: 0.78rem; }
.audit-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}
.audit-ok { background: rgba(34, 197, 94, 0.15); color: #166534; border: 1px solid rgba(34, 197, 94, 0.3); }
.audit-fail { background: rgba(239, 68, 68, 0.15); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.3); }
.audit-row-fail { background: rgba(239, 68, 68, 0.05); }
.security-audit-footer { margin-top: 10px; color: var(--muted, #64748b); font-size: 0.85rem; }
.active-sessions-hint { color: var(--muted, #64748b); font-size: 0.85rem; }

.admin-watch-list { display: flex; flex-direction: column; gap: 10px; }
.admin-watch-item {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--card-border, #e2e8f0);
    border-radius: 12px;
    background: var(--card-bg, #fff);
}
.admin-watch-item.is-fail { border-color: rgba(239, 68, 68, 0.4); }
.admin-watch-item-title { font-weight: 700; font-size: 0.95rem; }
.admin-watch-item-action { margin-top: 2px; }
.admin-watch-item-meta { margin-top: 4px; font-size: 0.8rem; color: var(--text-muted, #64748b); }
.admin-watch-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-watch-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.admin-watch-search {
    min-width: 220px;
    flex: 1;
    max-width: 320px;
    padding: 6px 10px;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 8px;
    font-size: 0.9rem;
}
.admin-watch-badge {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}
.admin-watch-badge.is-session { background: rgba(100, 116, 139, 0.18); color: #475569; }
.admin-watch-badge.is-work { background: rgba(22, 163, 74, 0.16); color: #15803d; }
.admin-watch-badge.is-history { background: rgba(37, 99, 235, 0.14); color: #1d4ed8; }
.admin-watch-item.is-session { opacity: 0.92; }
.admin-watch-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(148, 163, 184, 0.15); }
.admin-watch-note.is-work { background: rgba(22, 163, 74, 0.12); }
