:root {
    --accent: #0078D7;
    /* Windows Blue */
    --accent-dark: #005A9E;
    --bg-color: #F2F2F2;
    --surface: #FFFFFF;
    --text-primary: #111111;
    --text-secondary: #666666;
    --border-color: #D2D2D2;
    --success: #107C10;
    --warning: #D83B01;
    /* Metro Orange/Red */
    --danger: #E81123;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    min-height: 100vh;
}

/* --- HEADER (Metro AppBar) --- */
.app-header {
    background-color: #2B2B2B;
    /* Dark gray standard for Win10 apps */
    height: 48px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.header-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-brand {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-brand ion-icon {
    font-size: 1.4rem;
    color: var(--accent);
}

.app-nav {
    display: flex;
    gap: 20px;
}

.app-nav a {
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.app-nav a:hover {
    color: var(--accent);
}

/* --- LAYOUT --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px;
}

/* --- METRO TILES & CARDS --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    /* Interactive Card Link */
}

a.card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: outline 0.1s;
}

a.card:hover {
    outline: 2px solid rgba(0, 0, 0, 0.1);
    background: #FAFAFA;
}

a.card .card-title {
    font-size: 1.4rem;
    font-weight: 300;
    color: white;
    margin-bottom: 15px;
    display: block;
}

/* --- COMMUNICATIONS (Official Circular Style) --- */
.comm-card {
    background: white;
    border: 1px solid #CCC;
    padding: 0;
    /* Let children handle padding */
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.comm-header {
    background: #F4F4F4;
    padding: 15px 20px;
    border-bottom: 1px solid #E0E0E0;
    border-top: 4px solid var(--accent);
    /* Color strip */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.comm-badge {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 6px;
    display: inline-block;
    margin-bottom: 5px;
}

.comm-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.comm-date {
    font-size: 0.8rem;
    color: #888;
}

.comm-body {
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #444;
    flex-grow: 1;
    background-image: linear-gradient(#F9F9F9 1px, transparent 1px);
    background-size: 100% 2rem;
    /* Subtle lines */
}

.comm-footer {
    padding: 10px 20px;
    background: #FAFAFA;
    border-top: 1px solid #EEE;
    text-align: right;
}

/* --- BUTTONS --- */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 2px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-secondary {
    background: #DDD;
    color: black;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #999;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-control:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

/* --- UTILS --- */
.table-responsive {
    overflow-x: auto;
    border: 1px solid #DDD;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #EEE;
}

.table th {
    background: #F9F9F9;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #666;
}

.text-muted {
    color: var(--text-secondary);
}

.mb-2 {
    margin-bottom: 10px;
}

.mb-4 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.hidden {
    display: none;
}

/* --- AVATARS --- */
.avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    object-fit: cover;
}

.avatar-xl {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.avatar-placeholder {
    background: #EEE;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    border: 1px solid #666;
    /* High contrast border */
}

.modal-header {
    background: var(--accent);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

/* --- FEED --- */
.feed-item {
    padding: 15px;
    background: white;
    margin-bottom: 10px;
    border: 1px solid #EEE;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.feed-user {
    font-weight: bold;
    color: var(--accent);
}

/* --- BADGES --- */
.badge {
    padding: 2px 6px;
    font-size: 0.75rem;
    color: white;
    background: #666;
    font-weight: bold;
    display: inline-block;
}

.badge-warning {
    background: var(--warning);
}

.badge-danger {
    background: var(--danger);
}

.badge-success {
    background: var(--success);
}

/* --- OFFLINE MODE --- */
.offline-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--danger);
    color: white;
    text-align: center;
    padding: 12px 10px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 10001;
    /* Above everything */
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.offline-mode body {
    padding-bottom: 50px;
    /* Space for banner */
}

.offline-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
        padding-bottom: 80px;
    }
}