/* =========================================================================
   Dotinker — internal app shell (admin + employee portal)
   Dark sidebar in brand navy/green, light content area for readable
   data-dense tables and forms.
   ========================================================================= */

body.app { background: var(--paper-soft); min-height: 100vh; }

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

/* Sidebar -------------------------------------------------------------------- */
.app-sidebar {
    width: 250px; flex-shrink: 0;
    background: var(--navy-900); color: var(--text-on-dark);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px 18px; font-family: var(--font-mono); font-weight: 700; }
.app-sidebar .brand img { height: 30px; }
.app-sidebar nav { padding: 10px 14px; flex: 1; }
.app-sidebar .nav-section-label { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(243,243,243,0.35); padding: 16px 12px 6px; }
.app-sidebar a.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 0.89rem; color: var(--text-on-dark-muted); font-weight: 500;
    margin-bottom: 2px;
}
.app-sidebar a.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; flex-shrink: 0; }
.app-sidebar a.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text-on-dark); }
.app-sidebar a.nav-link.active { background: var(--brand-green); color: var(--navy-900); font-weight: 700; }
.app-sidebar a.nav-link.active .dot { background: var(--navy-900); opacity: 1; }
.app-sidebar .sidebar-foot { padding: 16px 22px; border-top: 1px solid var(--line-on-dark); font-size: 0.78rem; color: var(--text-on-dark-muted); }

/* Main column ------------------------------------------------------------------ */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    height: 70px; flex-shrink: 0; background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.app-topbar .page-title { font-family: var(--font-display); font-size: 1.3rem; }
.app-topbar .top-actions { display: flex; align-items: center; gap: 18px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: flex; align-items: center; justify-content: center; }
.icon-btn .ping { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--paper); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .name { font-size: 0.86rem; font-weight: 600; }
.topbar-user .role { font-size: 0.72rem; color: var(--ink-500); }
.topbar-user .avatar-circle { overflow: hidden; border-radius: 50%;}
.mobile-menu-btn { display: none; background: none; border: none; }

.app-content { padding: 28px; flex: 1; }
.app-content .content-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.app-content .content-head h1 { font-size: 1.5rem; margin: 0; }
.app-content .content-head .sub { color: var(--ink-500); font-size: 0.88rem; margin-top: 4px; }

@media (max-width: 980px) {
    .app-sidebar { position: fixed; z-index: 200; transform: translateX(-100%); transition: transform .2s ease; }
    .app-sidebar.open { transform: translateX(0); }
    .mobile-menu-btn { display: flex; }
    .app-content { padding: 18px; }
}

/* Stat cards ------------------------------------------------------------------------ */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 980px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-cards { grid-template-columns: 1fr; } }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; }
.stat-card .stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; }
.stat-card .stat-icon.green { background: rgba(124,241,4,0.16); color: #4C9200; }
.stat-card .stat-icon.blue { background: rgba(45,98,224,0.12); color: var(--brand-blue); }
.stat-card .stat-icon.purple { background: rgba(164,167,255,0.24); color: #6367CC; }
.stat-card .stat-icon.yellow { background: rgba(255,243,110,0.32); color: #9C8B00; }
.stat-card .stat-num { font-family: var(--font-display); font-size: 1.9rem; margin-top: 14px; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--ink-500); }
.stat-card .stat-delta { font-size: 0.76rem; font-weight: 600; }
.stat-card .stat-delta.up { color: var(--ok); }
.stat-card .stat-delta.down { color: var(--danger); }

/* Panels / cards ---------------------------------------------------------------------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); }
.panel .panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.panel .panel-head h3 { margin: 0; font-size: 1rem; font-family: var(--font-body); font-weight: 700; }
.panel .panel-body { padding: 22px; }
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* Tables --------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); font-weight: 700; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--paper-soft); }
table.data-table tbody tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; }
.row-actions a, .row-actions button { font-size: 0.78rem; font-weight: 600; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); }
.row-actions a:hover { border-color: var(--brand-green); color: var(--brand-green-dark); }
.row-actions .danger:hover { border-color: var(--danger); color: var(--danger); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-500); }
.empty-state .glyph { font-family: var(--font-display); font-size: 2rem; color: var(--line); margin-bottom: 10px; }

.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell .name { font-weight: 600; }
.person-cell .sub { font-size: 0.76rem; color: var(--ink-500); }

/* Filters / toolbars ---------------------------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .input, .toolbar select.input { width: auto; min-width: 160px; padding: 9px 12px; }
.tab-row { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tab-row a { padding: 10px 16px; font-size: 0.86rem; font-weight: 600; color: var(--ink-500); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-row a.active { color: var(--navy-900); border-color: var(--brand-green); }

/* Kanban board ------------------------------------------------------------------------------- */
.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; }
@media (max-width: 900px) { .kanban-board { grid-template-columns: 1fr; } }
.kanban-col { background: var(--paper-soft); border-radius: var(--radius-md); padding: 14px; min-height: 120px; }
.kanban-col .col-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; font-weight: 700; padding: 4px 6px 14px; }
.kanban-col .col-head .count { font-family: var(--font-mono); color: var(--ink-500); font-weight: 500; }
.kanban-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 10px; }
.kanban-card:hover { border-color: var(--brand-green); }
.kanban-card .title { font-size: 0.87rem; font-weight: 600; margin-bottom: 8px; }
.kanban-card .meta-row { display: flex; justify-content: space-between; align-items: center; }
.kanban-card .due { font-size: 0.72rem; color: var(--ink-500); font-family: var(--font-mono); }

/* Timeline / activity feed ---------------------------------------------------------------------- */
.activity-feed .item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-feed .item:last-child { border-bottom: none; }
.activity-feed .bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-green); margin-top: 6px; flex-shrink: 0; }
.activity-feed .desc { font-size: 0.86rem; }
.activity-feed .when { font-size: 0.74rem; color: var(--ink-500); font-family: var(--font-mono); }

/* Letter / document preview ------------------------------------------------------------------------ */
.letter-preview { background: white; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 46px; font-family: 'Times New Roman', serif; max-width: 720px; margin: 0 auto; color: #1a1a1a; }
.letter-preview .letterhead { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--brand-green); padding-bottom: 16px; margin-bottom: 30px; }
.letter-preview .letterhead img { height: 40px; }
.letter-preview .ref { text-align: right; font-size: 0.8rem; color: #666; margin-bottom: 20px; }

/* Login / auth screens ------------------------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } }
.auth-visual { background: var(--navy-900); color: var(--text-on-dark); padding: 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-visual .grid-bg { position: absolute; inset: 0; opacity: 0.5; background-image: linear-gradient(var(--line-on-dark) 1px, transparent 1px), linear-gradient(90deg, var(--line-on-dark) 1px, transparent 1px); background-size: 42px 42px; }
.auth-visual > * { position: relative; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font-family: var(--font-mono); font-weight: 700; }
.auth-box .brand img { height: 32px; }

/* Month calendar (holidays / leave / birthdays) ---------------------------------------------------------- */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-nav h3 { margin: 0; font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; }
.calendar-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; font-size: 0.78rem; color: var(--ink-500); }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.calendar-legend .dot.holiday { background: var(--brand-green); }
.calendar-legend .dot.leave { background: var(--brand-yellow); }
.calendar-legend .dot.birthday { background: var(--brand-purple); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-grid .dow { text-align: center; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; color: var(--ink-500); padding-bottom: 6px; }
.calendar-cell { min-height: 84px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; background: var(--paper); display: flex; flex-direction: column; gap: 3px; }
.calendar-cell.empty { background: transparent; border-color: transparent; }
.calendar-cell.today { border-color: var(--brand-green); border-width: 2px; padding: 5px; }
.calendar-cell .date-num { font-size: 0.78rem; font-weight: 600; color: var(--ink-700); }
.calendar-cell .cal-marker { font-size: 0.66rem; padding: 2px 5px; border-radius: 5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-cell .cal-marker.holiday { background: rgba(124,241,4,0.18); color: #3F7A00; }
.calendar-cell .cal-marker.leave { background: rgba(255,243,110,0.45); color: #7A6900; }
.calendar-cell .cal-marker.birthday { background: rgba(164,167,255,0.28); color: #4B4FCC; }
@media (max-width: 700px) {
    .calendar-cell { min-height: 56px; font-size: 0.72rem; }
    .calendar-cell .cal-marker { display: none; }
    .calendar-cell.has-marker::after { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-green); }
}

/* Signature pad --------------------------------------------------------------------------------------- */
.signature-preview { height: 70px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 14px; display: inline-flex; align-items: center; margin-bottom: 12px; }
.signature-preview img { max-height: 100%; max-width: 220px; }
#signaturePad { border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: #fff; touch-action: none; cursor: crosshair; display: block; width: 100%; max-width: 400px; height: 150px; }

/* Misc utility --------------------------------------------------------------------------------------- */
.progress-bar { height: 8px; background: var(--paper-soft); border-radius: 99px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--brand-green); }
.rating-stars { color: var(--brand-yellow); filter: saturate(1.4) brightness(0.85); }
.notif-dropdown { position: absolute; right: 0; top: 52px; width: 320px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md); display: none; z-index: 50; max-height: 400px; overflow-y: auto; }
.notif-dropdown.open { display: block; }
.notif-dropdown .n-item { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 0.83rem; }
.notif-dropdown .n-item.unread { background: rgba(124,241,4,0.06); }
.user-menu-wrap { position: relative; }
