/* =============================================
   360 Support Inc — Daily Work Log
   Brand: Sky blue (#4DA6D9), Deep navy (#1C3557)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:      #1C3557;
    --primary-lt:   #2A4E78;
    --accent:       #4DA6D9;
    --accent-lt:    #7EC8EF;
    --success:      #22a94f;
    --success-bg:   #e8f7ee;
    --danger:       #d63031;
    --danger-bg:    #fdecea;
    --warning:      #e67e22;
    --warning-bg:   #fef3e2;
    --pending:      #636e72;
    --pending-bg:   #f1f3f5;
    --bg:           #f0f4f8;
    --surface:      #ffffff;
    --border:       #dde3ea;
    --text:         #1a2332;
    --text-muted:   #6b7a90;
    --radius:       10px;
    --radius-lg:    16px;
    --shadow:       0 2px 12px rgba(28,53,87,0.08);
    --shadow-lg:    0 8px 32px rgba(28,53,87,0.14);
    --sidebar-w:    260px;
    --header-h:     64px;
}

html { font-size: 15px; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Typography ---- */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p  { color: var(--text-muted); }

/* ---- Layout ---- */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s ease;
}
.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo img { height: 40px; filter: brightness(0) invert(1); }
.sidebar-logo span { font-size: 0.78rem; font-weight: 500; opacity: 0.75; line-height: 1.3; }
.sidebar-nav { flex: 1; padding: 20px 0; }
.nav-section { padding: 0 16px; margin-bottom: 4px; }
.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    padding: 12px 8px 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.sidebar-user {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 0.72rem; color: rgba(255,255,255,0.55); text-transform: capitalize; }
.btn-logout {
    background: none; border: none; color: rgba(255,255,255,0.5);
    cursor: pointer; padding: 4px; border-radius: 6px;
    transition: color 0.15s;
    display: flex; align-items: center;
}
.btn-logout:hover { color: #fff; }
.btn-logout svg { width: 18px; height: 18px; }

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-title h1 { font-size: 1.1rem; }
.topbar-title p  { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.page-content { padding: 28px 32px; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-body { padding: 20px 24px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-lt); }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-accent:hover    { background: #3a90c0; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #1a8a40; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #b52828; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover   { border-color: var(--accent); color: var(--accent); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover     { background: var(--bg); color: var(--text); }
.btn-sm        { padding: 5px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-icon      { padding: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77,166,217,0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-done     { background: var(--success-bg); color: var(--success); }
.badge-notdone  { background: var(--danger-bg);  color: var(--danger);  }
.badge-pending  { background: var(--pending-bg); color: var(--pending); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); }
.badge-accent   { background: #e0f3fb; color: #1a7baa; }
.badge-mandatory { background: #eef1ff; color: #3d52c4; font-size: 0.68rem; padding: 2px 7px; }

/* ---- Progress Bar ---- */
.progress-wrap { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.progress-bar.good    { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger);  }
.progress-bar.zero    { background: var(--border);  }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-info    { background: #e0f3fb; color: #1a6d9a; border-left: 4px solid var(--accent); }
.alert-success { background: var(--success-bg); color: #1a6e36; border-left: 4px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: #8b1a1a; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #7a4a0e; border-left: 4px solid var(--warning); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #0e2240 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(77,166,217,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}
.login-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 64px; }
.login-title { text-align: center; margin-bottom: 28px; }
.login-title h1 { font-size: 1.4rem; color: var(--primary); margin-bottom: 4px; }
.login-title p  { font-size: 0.875rem; }

/* ---- Daily Log Page ---- */
.log-date-nav {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 20px;
}
.log-date-nav h2 { flex: 1; font-size: 1rem; }
.task-list { display: flex; flex-direction: column; gap: 0; }
.task-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: #fafbfc; }
.task-check {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: 2px;
}
.task-status-btns { display: flex; gap: 6px; }
.btn-status {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-status:hover { border-color: var(--accent); color: var(--accent); }
.btn-status.active-done     { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.btn-status.active-not-done { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger);  }
.task-body { flex: 1; min-width: 0; }
.task-name { font-size: 0.9rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.task-name.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.task-reason-row { margin-top: 10px; }
.task-reason-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--danger);
    border-radius: 7px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    color: var(--text);
    min-height: 60px;
}
.task-reason-row textarea:focus { box-shadow: 0 0 0 3px rgba(214,48,49,0.12); }
.task-delete {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 5px;
    transition: color 0.15s;
    flex-shrink: 0;
}
.task-delete:hover { color: var(--danger); }

.add-task-bar {
    display: flex; gap: 8px; padding: 14px 16px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.add-task-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    background: var(--surface);
}
.add-task-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77,166,217,0.12); }

.saving-indicator {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}
.saving-indicator.visible { opacity: 1; }

/* ---- Dashboard ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-align: center;
}
.stat-card .stat-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.s-total  .stat-num { color: var(--primary); }
.stat-card.s-done   .stat-num { color: var(--success); }
.stat-card.s-nd     .stat-num { color: var(--danger); }
.stat-card.s-pend   .stat-num { color: var(--warning); }

.emp-grid { display: flex; flex-direction: column; gap: 0; }
.emp-row {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s;
}
.emp-row:last-child { border-bottom: none; }
.emp-row:hover { background: #fafbfc; }
.emp-row.expanded { background: #fafbfd; }
.emp-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
    flex-shrink: 0;
}
.emp-info { flex: 1; min-width: 0; }
.emp-name { font-weight: 600; font-size: 0.9rem; }
.emp-role { font-size: 0.78rem; color: var(--text-muted); }
.emp-progress { width: 140px; flex-shrink: 0; }
.emp-progress-text { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; text-align: right; }
.emp-status { flex-shrink: 0; }
.emp-tasks-detail {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 16px 20px 16px 76px;
    display: none;
}
.emp-tasks-detail.open { display: block; }
.detail-task-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.detail-task-row:last-child { border-bottom: none; }
.detail-task-name { flex: 1; }
.detail-task-reason { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-top: 2px; }

.filter-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-bar input[type=date], .filter-bar select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    background: var(--surface);
    cursor: pointer;
}
.filter-bar input[type=date]:focus, .filter-bar select:focus { border-color: var(--accent); }

/* ---- Admin Panel ---- */
.admin-tabs {
    display: flex; gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
}
.tab-btn {
    padding: 8px 18px;
    border: none; border-radius: 7px;
    font-size: 0.875rem; font-weight: 600; font-family: inherit;
    cursor: pointer; background: transparent;
    color: var(--text-muted);
    transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.96);
    transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-body   { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
}
.btn-modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 5px;
}
.btn-modal-close:hover { color: var(--text); }

/* ---- Utility ---- */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.fw-600 { font-weight: 600; }
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ---- Spinner ---- */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
#toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--primary); color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
    max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- No-log message ---- */
.no-log-box {
    text-align: center; padding: 60px 24px;
    color: var(--text-muted);
}
.no-log-box svg { opacity: 0.25; margin-bottom: 16px; }
.no-log-box h3 { color: var(--text); margin-bottom: 6px; }
