/**
 * FTN Hub - Stylesheet
 * Modern mail reader interface
 */

/* ============== Base Reset ============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ============== Typography ============== */
@font-face {
    font-family: 'DOS';
    src: url('https://cdn.jsdelivr.net/gh/viler-int10h/vga-text-mode-fonts@master/FONTS/WEB/Mx437_IBM_VGA_8x16.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    color: #202124;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== Layout ============== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 56px;
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 500;
    color: #5f6368;
}
.brand-icon { font-size: 28px; }
.brand-text { color: #202124; font-weight: 600; }

.header-nav {
    display: flex;
    gap: 4px;
}
.header-nav a {
    padding: 8px 16px;
    border-radius: 8px;
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.header-nav a:hover { background: #f1f3f4; text-decoration: none; }
.header-nav a.active { background: #e8f0fe; color: #1967d2; }

.header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #5f6368;
}
.user-role { font-size: 12px; opacity: 0.7; }
.btn-logout {
    padding: 6px 12px;
    background: #f1f3f4;
    border-radius: 4px;
    color: #5f6368;
    font-size: 13px;
}
.btn-logout:hover { background: #e0e0e0; text-decoration: none; }

.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.app-footer {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #5f6368;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

/* ============== Sidebar ============== */
.sidebar {
    width: 260px;
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
}
.sidebar-header .area-count {
    font-size: 12px;
    color: #fff;
    background: #5f6368;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Netmail Folders */
.netmail-folders {
    padding: 8px 0;
}
.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #444;
    font-size: 14px;
    transition: background 0.15s;
}
.folder-item:hover {
    background: #f0f0f0;
    text-decoration: none;
}
.folder-item.active {
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 500;
}
.folder-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.folder-name {
    flex: 1;
}
.folder-count {
    font-size: 12px;
    color: #888;
    background: #e8eaed;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.folder-item.active .folder-count {
    background: #bbdefb;
    color: #1565c0;
}

.compose-btn {
    display: block;
    margin: 12px 12px 0 12px;
    padding: 10px 16px;
    background: #1a73e8;
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.compose-btn:hover {
    background: #1557b0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.area-list { flex: 1; overflow-y: auto; padding: 8px 0; }

.network-group {
    margin-bottom: 4px;
}
.network-group[open] { margin-bottom: 8px; }

.network-name {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #202124;
    border-left: 3px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.network-name:hover { background: #f0f0f0; }
.network-name::marker { display: none; }
.network-name::-webkit-details-marker { display: none; }
.network-count { 
    font-size: 11px; 
    font-weight: 500;
    color: #5f6368;
    background: #e8eaed;
    padding: 2px 8px;
    border-radius: 10px;
}

.area-items {
    list-style: none;
    padding: 4px 0;
    background: #fff;
}

.area-item a {
    display: flex;
    align-items: center;
    padding: 8px 16px 8px 28px;
    color: #444;
    font-size: 13px;
    transition: background 0.15s;
}
.area-item a:hover { background: #f5f5f5; text-decoration: none; }
.area-item.active a { background: #e3f2fd; color: #1565c0; font-weight: 500; }
.area-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-item .area-count { 
    font-size: 11px; 
    color: #888; 
    min-width: 30px;
    text-align: right;
}

/* ============== Content Area ============== */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

/* ============== Toolbar ============== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
}
.toolbar-title {
    font-size: 20px;
    font-weight: 500;
    color: #202124;
    margin: 0;
}
.toolbar-spacer { flex: 1; }
.toolbar-info { font-size: 14px; color: #666; }
.toolbar-btn {
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    background: #f1f3f4;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
}
.toolbar-btn:hover { background: #e0e0e0; text-decoration: none; color: #202124; }
.toolbar-btn.primary { background: #1a73e8; color: #fff; }
.toolbar-btn.primary:hover { background: #1557b0; color: #fff; }
.toolbar-divider { width: 1px; height: 24px; background: #e0e0e0; }

/* Buttons */
.btn {
    height: 36px;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
}
.btn-primary {
    background: #1a73e8;
    color: #fff;
}
.btn-primary:hover { background: #1557b0; text-decoration: none; color: #fff; }
.btn-secondary {
    background: #f1f3f4;
    color: #5f6368;
}
.btn-secondary:hover { background: #e0e0e0; text-decoration: none; }

/* ============== Message List ============== */
.message-list {
    flex: 1;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #888;
    font-size: 15px;
}

/* Message Table */
.msg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.msg-table thead {
    background: #f5f5f5;
    position: sticky;
    top: 0;
}
.msg-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #5f6368;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}
.msg-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 14px;
    color: #202124;
}
.msg-table .col-from { width: 350px; min-width: 350px; }
.msg-table .col-node { width: 120px; font-family: monospace; }
.msg-table .col-subject { width: auto; }
.msg-table .col-date { width: 150px; text-align: right; white-space: nowrap; }

/* Sortable headers */
.msg-table th.sortable a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.msg-table th.sortable a:hover { color: #1a73e8; }

/* View toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    margin-right: 12px;
}
.view-toggle .toolbar-btn { padding: 0 12px; }
.toolbar-btn.active { background: #1a73e8; color: #fff; }
.toolbar-btn.active:hover { background: #1557b0; color: #fff; }

/* Thread arrows */
.thread-arrow {
    color: #1a73e8;
    font-weight: bold;
    margin-right: 4px;
}

.msg-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}
.msg-table tbody tr:hover { background: #f5f5f5; }
.msg-table tbody tr.unread { background: #e8f4fd; }
.msg-table tbody tr.unread td { font-weight: 500; }
.msg-table tbody tr.unread .col-from { color: #1a73e8; font-weight: 600; }

.msg-table .col-subject {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============== Message View ============== */
.message-view { flex: 1; overflow-y: auto; }
.message-header { padding: 24px 24px 16px; border-bottom: 1px solid #e0e0e0; }
.message-subject { font-size: 22px; font-weight: 400; color: #202124; margin-bottom: 16px; }
.message-participants { display: flex; align-items: flex-start; gap: 16px; }
.message-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #1a73e8; color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 500; font-size: 16px; flex-shrink: 0;
}
.message-info { flex: 1; }
.message-from-line { display: flex; align-items: center; gap: 8px; }
.message-from-name { font-weight: 500; color: #202124; }
.message-from-addr { font-size: 13px; color: #5f6368; }
.message-to-line { font-size: 13px; color: #5f6368; margin-top: 2px; }
.message-date-full { font-size: 13px; color: #5f6368; white-space: nowrap; }

.message-body {
    padding: 24px;
    font-family: 'DOS', 'Fixedsys Excelsior', 'IBM Plex Mono', 'Consolas', monospace;
    font-size: 16px;
    line-height: 1.2;
    white-space: pre;
    word-wrap: normal;
    overflow-x: auto;
    background: #1e1e1e;
    color: #d4d4d4;
    margin: 16px 24px;
    border-radius: 8px;
}
.message-body .quote { color: #6a9955; }
.message-body .origin { color: #808080; }

.message-kludges {
    padding: 12px 24px;
    margin: 0 24px 24px;
    background: #f8f9fa;
    border-radius: 8px;
    font-family: monospace;
    font-size: 11px;
    color: #5f6368;
}
.kludge { margin-bottom: 2px; }
.kludge-key { color: #1a73e8; }

/* ============== Compose Form ============== */
.compose-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.compose-header { padding: 16px 24px; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; gap: 16px; }
.compose-header h2 { font-size: 18px; font-weight: 500; color: #202124; }
.compose-form { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.compose-fields { padding: 0 24px; border-bottom: 1px solid #e0e0e0; }
.compose-field { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1f3f4; }
.compose-field:last-child { border-bottom: none; }
.compose-field label { width: 80px; font-size: 14px; color: #5f6368; flex-shrink: 0; }
.compose-field input, .compose-field select {
    flex: 1;
    border: none;
    font-size: 14px;
    color: #202124;
    outline: none;
    padding: 4px 0;
    font-family: inherit;
    background: transparent;
}
.compose-field input::placeholder { color: #80868b; }

/* Autocomplete for To field */
.autocomplete-wrap {
    flex: 1;
    position: relative;
}
.autocomplete-wrap input {
    width: 100%;
}
.autocomplete-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}
.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover,
.autocomplete-item.active {
    background: #e8f0fe;
}

.compose-body-wrap { flex: 1; padding: 16px 24px; overflow: hidden; display: flex; flex-direction: column; }
.compose-body { 
    flex: 1; 
    border: none; 
    resize: none; 
    font-family: 'DOS', 'Fixedsys Excelsior', 'IBM Plex Mono', 'Consolas', monospace; 
    font-size: 15px; 
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    outline: none;
}
.compose-actions { padding: 16px 24px; border-top: 1px solid #e0e0e0; display: flex; gap: 12px; }
.compose-hint { font-size: 12px; color: #5f6368; margin-left: auto; }

/* ============== Buttons ============== */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: #1a73e8; color: white; }
.btn-primary:hover { background: #1557b0; text-decoration: none; }
.btn-secondary { background: #fff; color: #5f6368; border: 1px solid #dadce0; }
.btn-secondary:hover { background: #f1f3f4; text-decoration: none; }
.btn-danger { background: #c5221f; color: white; }
.btn-danger:hover { background: #a31f1c; text-decoration: none; }
.btn-block { width: 100%; justify-content: center; }

/* ============== Alerts ============== */
.alert { padding: 12px 16px; border-radius: 4px; margin: 16px; font-size: 14px; }
.alert-success { background: #e6f4ea; color: #137333; }
.alert-error { background: #fce8e6; color: #c5221f; }
.alert-info { background: #e8f0fe; color: #174ea6; }

/* ============== Forms ============== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; color: #374151; margin-bottom: 8px; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}
.form-group input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin-right: 8px;
    vertical-align: middle;
}
.form-group label input[type="checkbox"] { display: inline; }
.form-group label:has(input[type="checkbox"]) { display: flex; align-items: center; cursor: pointer; }

/* ============== Address Book ============== */
.addressbook-content { padding: 24px; }
.addressbook-add { background: #f8f9fa; padding: 20px; border-radius: 12px; margin-bottom: 24px; }
.addressbook-add h3 { font-size: 16px; font-weight: 500; color: #202124; margin-bottom: 16px; }
.addressbook-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.addressbook-form input { padding: 10px 14px; border: 1px solid #dadce0; border-radius: 8px; font-size: 14px; outline: none; }
.addressbook-form input:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,0.2); }
.addressbook-form input[name="name"] { flex: 2; min-width: 150px; }
.addressbook-form input[name="address"] { flex: 1; min-width: 120px; }

.addressbook-list { display: flex; flex-direction: column; gap: 8px; }
.addressbook-empty { padding: 40px; text-align: center; color: #5f6368; font-size: 14px; }
.addressbook-item { display: flex; align-items: center; gap: 16px; padding: 16px; background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; transition: box-shadow 0.15s; }
.addressbook-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.addressbook-avatar { width: 48px; height: 48px; border-radius: 50%; background: #1a73e8; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; flex-shrink: 0; }
.addressbook-info { flex: 1; }
.addressbook-name { font-size: 16px; font-weight: 500; color: #202124; }
.addressbook-addr { font-size: 14px; color: #5f6368; font-family: monospace; }
.addressbook-actions { display: flex; gap: 8px; }

/* ============== Admin Dashboard ============== */
.admin-layout {
    display: flex;
    flex: 1;
    height: 100%;
    background: #f5f7fa;
}
.admin-sidebar {
    width: 240px;
    background: #1e293b;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.admin-nav {
    padding: 16px 12px;
    flex: 1;
}
.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 4px;
}
.admin-nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
}
.admin-nav-item.active {
    background: #3b82f6;
    color: white;
}
.admin-nav-item .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.admin-nav-item .nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.admin-sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.admin-main {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}
.admin-header {
    margin-bottom: 32px;
}
.admin-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.admin-subtitle {
    color: #64748b;
    font-size: 15px;
    margin-top: 4px;
}
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.admin-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    position: relative;
}
.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}
.stat-icon-wrap.blue { background: #dbeafe; }
.stat-icon-wrap.purple { background: #ede9fe; }
.stat-icon-wrap.green { background: #dcfce7; }
.stat-icon-wrap.orange { background: #ffedd5; }
.stat-content .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}
.stat-content .stat-label {
    font-size: 14px;
    color: #64748b;
    margin-top: 4px;
}
.stat-link {
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
    margin-top: 12px;
}
.stat-link:hover { text-decoration: underline; }
.stat-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
}
.admin-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.admin-mini-stat {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.admin-mini-stat.alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.mini-icon { font-size: 20px; }
.mini-value { font-size: 20px; font-weight: 700; color: #1e293b; }
.mini-label { font-size: 13px; color: #64748b; }
.admin-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}
.admin-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.panel-action {
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
}
.panel-action:hover { text-decoration: underline; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    padding: 14px 24px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}
.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table tbody tr:hover { background: #f8fafc; }
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.user-cell .user-name {
    font-weight: 500;
    color: #1e293b;
}
.user-cell .user-handle {
    font-size: 12px;
    color: #94a3b8;
}
.text-muted { color: #94a3b8; font-size: 13px; }
.activity-list {
    padding: 8px 0;
}
.activity-item {
    display: flex;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.activity-content { flex: 1; min-width: 0; }
.activity-text {
    font-size: 14px;
    color: #475569;
    line-height: 1.4;
}
.activity-text strong { color: #1e293b; }
.activity-time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
.activity-empty {
    padding: 32px;
    text-align: center;
    color: #94a3b8;
}
.badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-admin, .badge-superadmin { background: #fef2f2; color: #dc2626; }
.badge-nodeadmin { background: #eff6ff; color: #2563eb; }
.badge-point { background: #f0fdf4; color: #16a34a; }
.badge-active { background: #f0fdf4; color: #16a34a; }
.badge-pending { background: #fffbeb; color: #d97706; }
.badge-suspended, .badge-inactive { background: #f1f5f9; color: #64748b; }

/* ============== Pagination ============== */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; border-top: 1px solid #e0e0e0; }
.pagination a, .pagination span { padding: 8px 12px; font-size: 13px; color: #5f6368; border-radius: 4px; }
.pagination a:hover { background: #f1f3f4; text-decoration: none; }
.pagination .current { background: #e8f0fe; color: #1967d2; }

/* ============== Login Page ============== */
.login-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-container {
    background: rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-icon { font-size: 64px; display: block; margin-bottom: 16px; }
.login-brand h1 { font-size: 28px; font-weight: 700; color: #1e1b4b; margin-bottom: 8px; }
.login-brand .brand-subtitle { color: #6b7280; font-size: 14px; }
.login-form .form-group input {
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}
.login-form .form-group input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}
.login-form .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(99,102,241,0.3); }
.login-footer { text-align: center; margin-top: 24px; color: #6b7280; }

/* ============== Empty States ============== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #5f6368;
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: #202124; margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 400px; }

/* Dashboard */
.dashboard {
    padding: 32px;
    max-width: 900px;
}
.dashboard h2 {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 24px;
}
.dashboard h3 {
    font-size: 16px;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 12px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}
.stat-card.highlight {
    background: #e8f0fe;
    border-color: #1a73e8;
}
.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #202124;
}
.stat-card.highlight .stat-value {
    color: #1a73e8;
}
.stat-label {
    font-size: 13px;
    color: #5f6368;
    margin-top: 4px;
}
.network-stats {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
.network-stat-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
}
.network-stat-row:last-child {
    border-bottom: none;
}
.net-name {
    font-weight: 500;
    color: #202124;
    min-width: 150px;
}
.net-areas {
    color: #5f6368;
    font-size: 13px;
    min-width: 80px;
}
.net-msgs {
    color: #5f6368;
    font-size: 13px;
    min-width: 120px;
}
.net-unread {
    background: #1a73e8;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}
.dashboard-hint {
    margin-top: 24px;
    font-size: 14px;
    color: #888;
}

/* ============== Mobile Responsive ============== */
@media (max-width: 768px) {
    .app-header { padding: 8px 12px; gap: 12px; }
    .header-brand { font-size: 18px; }
    .brand-icon { font-size: 24px; }
    .header-nav { display: none; }
    .header-user .user-role { display: none; }
    
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        background: #fff;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }
    .sidebar.open { transform: translateX(0); }
    
    .msg-header { display: none; }
    .msg-row { flex-wrap: wrap; padding: 12px; gap: 4px; }
    .msg-from { width: auto; max-width: 120px; font-size: 13px; }
    .msg-node { width: auto; font-size: 11px; }
    .msg-content { width: 100%; order: 3; margin-top: 4px; }
    .msg-subject { font-size: 13px; }
    .msg-snippet { display: none; }
    .msg-date { margin-left: auto; font-size: 11px; }
    
    .message-body { font-size: 14px; padding: 12px; margin: 12px; }
    .compose-form { padding: 12px; }
    
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .admin-nav { display: flex; padding: 8px; gap: 4px; flex: 1; }
    .admin-nav-item { padding: 10px 14px; white-space: nowrap; }
    .admin-nav-item span:not(.nav-icon):not(.nav-badge) { display: none; }
    .admin-sidebar-footer { display: none; }
    .admin-main { padding: 16px; }
    .admin-stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .admin-panels { grid-template-columns: 1fr; }
    
    .login-container { padding: 32px 24px; }
    .login-brand .brand-icon { font-size: 48px; }
    .login-brand h1 { font-size: 24px; }
}

/* ============== Utility Classes ============== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
