/* ===================================================================
   Workspace Organizer — style.css
   A focused, high-contrast UI: indigo primary, amber accent, slate neutrals.
   Designed for fast, interactive work environments.
   =================================================================== */

/* ----- Design tokens ----- */
:root {
    /* Brand */
    --primary:        #2563eb;   /* blue-600 */
    --primary-dark:   #1d4ed8;
    --primary-light:  #dbeafe;
    --accent:         #f59e0b;   /* amber-500 */
    --accent-dark:    #d97706;

    /* Status */
    --success:        #10b981;
    --success-bg:     #d1fae5;
    --danger:         #ef4444;
    --danger-bg:      #fee2e2;
    --warning:        #f59e0b;
    --warning-bg:     #fef3c7;
    --info:           #0ea5e9;
    --info-bg:        #e0f2fe;

    /* Neutrals (slate scale) */
    --bg:             #f1f5f9;
    --surface:        #ffffff;
    --surface-2:      #f8fafc;
    --border:         #e2e8f0;
    --border-strong:  #cbd5e1;
    --text:           #0f172a;
    --text-muted:     #64748b;
    --text-soft:      #94a3b8;

    /* Sidebar */
    --sidebar-bg:     #0f172a;   /* slate-900 */
    --sidebar-bg-2:   #1e293b;
    --sidebar-text:   #e2e8f0;
    --sidebar-muted:  #94a3b8;
    --sidebar-active: #2563eb;

    /* Layout */
    --sidebar-w:      240px;
    --topbar-h:       60px;
    --radius:         8px;
    --radius-sm:      6px;
    --radius-lg:      12px;
    --shadow-sm:      0 1px 2px rgba(15,23,42,.05);
    --shadow:         0 1px 3px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.04);
    --shadow-lg:      0 8px 24px rgba(15,23,42,.12);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ----- Login & install pages ----- */
.login-page, .install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
    padding: 24px;
}
.login-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
}
.login-box h1 {
    margin: 0 0 4px;
    font-size: 22px;
    color: var(--text);
}
.login-box .sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}
.install-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 36px 40px;
    width: 100%;
    max-width: 760px;
}
.install-header h1 { margin: 0 0 4px; font-size: 24px; }
.install-log ol {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 16px 16px 40px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    max-height: 360px;
    overflow-y: auto;
}
.install-log li.fail { color: var(--danger); }
.install-actions { margin-top: 24px; }

/* ----- App layout ----- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar .brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--sidebar-bg-2);
    margin-bottom: 16px;
}
.sidebar .brand h2 {
    margin: 0;
    font-size: 17px;
    color: white;
    letter-spacing: -.01em;
}
.sidebar .brand .ver {
    font-size: 11px;
    color: var(--sidebar-muted);
    margin-top: 2px;
}
.sidebar .nav-group {
    padding: 0 12px;
    margin-bottom: 8px;
}
.sidebar .nav-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sidebar-muted);
    padding: 12px 8px 6px;
    font-weight: 600;
}
.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: background .12s, color .12s;
}
.sidebar a.nav-link:hover {
    background: var(--sidebar-bg-2);
}
.sidebar a.nav-link.active {
    background: var(--sidebar-active);
    color: white;
    font-weight: 500;
}
.sidebar .nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Top bar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.topbar .user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}
.topbar .user-info { text-align: right; line-height: 1.2; }
.topbar .user-info .name { font-weight: 600; }
.topbar .user-info .role { color: var(--text-muted); font-size: 11.5px; }
.topbar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.topbar a { color: var(--text-muted); text-decoration: none; }
.topbar a:hover { color: var(--primary); }

.content {
    padding: 24px;
    flex: 1;
    min-width: 0;
}

/* ----- Cards ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2, .card h3 {
    margin: 0 0 14px;
    color: var(--text);
}
.card h2 { font-size: 18px; }
.card h3 { font-size: 15px; }
.card-danger  { border-left: 4px solid var(--danger);  background: var(--danger-bg); }
.card-warning { border-left: 4px solid var(--warning); background: var(--warning-bg); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; }

/* ----- Stat cards (dashboard) ----- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .label { color: var(--text-muted); font-size: 12px;
                    text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text);
                    margin-top: 4px; line-height: 1; }
.stat-card .delta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger  { border-left: 4px solid var(--danger); }
.stat-card.info    { border-left: 4px solid var(--info); }

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s, transform .05s;
    line-height: 1;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--primary); color: white; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent  { background: var(--accent); color: white; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: white; border-color: var(--danger); }
.btn-ghost {
    background: transparent; color: var(--text); border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----- Forms ----- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-group .hint { font-size: 11.5px; color: var(--text-muted); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="datetime-local"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .12s, box-shadow .12s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.form-error {
    background: var(--danger-bg);
    color: #991b1b;
    border-left: 3px solid var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}
.form-error ul { margin: 4px 0 0 18px; padding: 0; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data th, table.data td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    position: sticky;
    top: 0;
}
table.data tbody tr {
    transition: background .08s;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data .actions { text-align: right; white-space: nowrap; }

/* ----- Badges ----- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); border-color: transparent; }
.badge-success { background: var(--success-bg); color: #047857; border-color: transparent; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: #92400e; border-color: transparent; }
.badge-info    { background: var(--info-bg);    color: #0369a1; border-color: transparent; }
.badge-muted   { background: #e2e8f0; color: var(--text-muted); border-color: transparent; }

/* Role chip */
.role-superadmin { background: #fef3c7; color: #92400e; }
.role-admin      { background: #dbeafe; color: #1e40af; }
.role-manager    { background: #d1fae5; color: #047857; }
.role-user       { background: #e2e8f0; color: #475569; }
.role-guest      { background: #f1f5f9; color: #64748b; }

/* ----- Filter bar ----- */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar input[type="search"], .filter-bar select {
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
}
.filter-bar input[type="search"]:focus, .filter-bar select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.filter-bar input[type="search"] { min-width: 220px; }

/* ----- Flash messages ----- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-left: 4px solid;
    font-size: 13.5px;
}
.flash-success { background: var(--success-bg); border-color: var(--success); color: #047857; }
.flash-info    { background: var(--info-bg);    border-color: var(--info);    color: #0369a1; }
.flash-warn    { background: var(--warning-bg); border-color: var(--warning); color: #92400e; }
.flash-error   { background: var(--danger-bg);  border-color: var(--danger);  color: #991b1b; }

/* ----- Toast (JS-driven) ----- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--surface);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px;
    font-size: 13.5px;
    min-width: 260px;
    animation: toast-in .2s ease-out;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warn    { border-color: var(--warning); }
@keyframes toast-in {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ----- Pagination ----- */
.pager { display: flex; gap: 4px; margin-top: 16px; align-items: center; }
.pager a, .pager span {
    padding: 5px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface);
}
.pager a:hover { background: var(--surface-2); }
.pager .current { background: var(--primary); color: white; border-color: var(--primary); }
.pager .info { color: var(--text-muted); margin-left: 8px; border: 0; background: transparent; }

/* ----- Misc ----- */
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px;
       font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 8px; opacity: .6; }

/* ----- Responsive ----- */
@media (max-width: 880px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: -280px; top: 0; width: 260px; height: 100vh;
        z-index: 200; transition: left .18s ease-out;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: inline-flex !important; }
    .topbar { padding: 0 14px; }
    .content { padding: 14px; }
    .topbar .user-info { display: none; }
}
.sidebar-toggle {
    display: none;
    background: transparent; border: 1px solid var(--border-strong);
    padding: 6px 10px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 16px;
}
.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.45); z-index: 150;
}
.sidebar-backdrop.show { display: block; }

/* ========================================================================
   Phase 2: Task module styles
   ====================================================================== */

/* Priority badges (P1=highest=red, P5=lowest=gray) */
.badge-prio-1 { background:#fee2e2; color:#991b1b; }
.badge-prio-2 { background:#ffedd5; color:#9a3412; }
.badge-prio-3 { background:#fef3c7; color:#92400e; }
.badge-prio-4 { background:#dbeafe; color:#1e40af; }
.badge-prio-5 { background:#e2e8f0; color:#475569; }

/* Overall task status badges */
.badge-status-new         { background:#dbeafe; color:#1e40af; }
.badge-status-in_progress { background:#fef3c7; color:#92400e; }
.badge-status-pending     { background:#fce7f3; color:#9d174d; }
.badge-status-done        { background:#dcfce7; color:#166534; }
.badge-status-close       { background:#e2e8f0; color:#334155; }

/* Per-assignee unit status */
.badge-unit-assigned       { background:#e0e7ff; color:#3730a3; }
.badge-unit-accepted       { background:#dcfce7; color:#166534; }
.badge-unit-rejected       { background:#fee2e2; color:#991b1b; }
.badge-unit-in_progress    { background:#fef3c7; color:#92400e; }
.badge-unit-pending        { background:#fce7f3; color:#9d174d; }
.badge-unit-require_action { background:#fed7aa; color:#9a3412; }
.badge-unit-complete       { background:#bbf7d0; color:#14532d; }
.badge-unit-transferred    { background:#dbeafe; color:#1e40af; }
.badge-unit-close          { background:#e2e8f0; color:#334155; }

/* Danger text */
.text-danger { color:#b91c1c; font-weight:600; }
.badge-danger { background:#fecaca; color:#991b1b; }

/* Task detail meta grid */
.task-meta {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap:.75rem 1.5rem;
    margin-bottom:1rem;
}
.task-meta > div { display:flex; flex-direction:column; gap:.15rem; }
.task-meta .muted { font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; }

/* Prose block for description */
.prose { margin-top:1rem; padding-top:1rem; border-top:1px solid #e2e8f0; }
.prose h4 { margin:0 0 .5rem; font-size:.9rem; color:#475569; text-transform:uppercase; letter-spacing:.04em;}
.prose p  { white-space:pre-wrap; }

/* Comment thread */
.comments { display:flex; flex-direction:column; gap:.85rem; margin-bottom:1rem; }
.comment {
    border:1px solid #e2e8f0;
    border-radius:8px;
    padding:.65rem .8rem;
    background:#f8fafc;
}
.comment-head { display:flex; align-items:center; gap:.5rem; font-size:.85rem; margin-bottom:.35rem; }
.comment-head .float-right { margin-left:auto; }
.comment-body { font-size:.92rem; line-height:1.5; white-space:pre-wrap; }

.comment-form textarea { width:100%; }

/* Assignee rows */
.assignee-list { display:flex; flex-direction:column; gap:.5rem; }
.assignee-row {
    display:flex; justify-content:space-between; align-items:flex-start;
    padding:.6rem .75rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
}
.assignee-row.is-me { border-color:#2563eb; background:#eff6ff; }

/* My-action panel */
.my-unit-action { padding-top:1rem; border-top:1px solid #e2e8f0; }
.my-unit-action h4 { margin:0 0 .5rem; font-size:.95rem; }

/* Inline forms */
.inline-form {
    display:flex; gap:.5rem; flex-wrap:wrap; align-items:center;
    padding:.5rem 0;
}
.inline-form select, .inline-form input { min-width: 140px; }

/* Checkbox grid for assignees */
.checkbox-grid {
    display:grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap:.4rem;
    max-height:240px; overflow:auto;
    padding:.5rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
}
.check-item {
    display:flex; gap:.5rem; align-items:center;
    padding:.3rem .5rem; border-radius:6px;
    cursor:pointer;
}
.check-item:hover { background:#e2e8f0; }
.check-item input { margin:0; }

/* Inline checkbox in filter form */
.inline-check { display:flex; align-items:center; gap:.4rem; font-size:.9rem; }
.inline-check input { margin:0; }

/* Header actions wrapper */
.header-actions { display:flex; gap:.5rem; flex-wrap:wrap; }

/* Change-log list */
.change-log-list { list-style:none; padding:0; margin:0; }
.change-log-list li {
    padding:.45rem 0;
    border-bottom:1px solid #f1f5f9;
    font-size:.85rem;
    line-height:1.5;
}
.change-log-list li:last-child { border-bottom:none; }
.change-log-list code {
    background:#f1f5f9; padding:.05rem .35rem; border-radius:4px;
    font-size:.82rem;
}

/* Link-strong for table titles */
.link-strong { font-weight:600; color:#1e40af; text-decoration:none; }
.link-strong:hover { text-decoration:underline; }

/* Mono utility */
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ========================================================================
   Phase 3: Agenda & Resources
   ====================================================================== */

/* Agenda statuses */
.badge-astatus-open      { background:#dbeafe; color:#1e40af; }
.badge-astatus-ongoing   { background:#fef3c7; color:#92400e; }
.badge-astatus-completed { background:#dcfce7; color:#166534; }
.badge-astatus-cancelled { background:#fee2e2; color:#991b1b; }

/* Resource statuses */
.badge-rstatus-active      { background:#dcfce7; color:#166534; }
.badge-rstatus-maintenance { background:#fef3c7; color:#92400e; }
.badge-rstatus-retired     { background:#e2e8f0; color:#475569; }

/* Agenda category badge palette */
.cat-appointment    { background:#dbeafe; color:#1e40af; }
.cat-guest          { background:#ffedd5; color:#9a3412; }
.cat-reservation    { background:#fce7f3; color:#9d174d; }
.cat-event          { background:#fef3c7; color:#92400e; }
.cat-meeting        { background:#e0e7ff; color:#3730a3; }
.cat-recurring      { background:#ccfbf1; color:#115e59; }
.cat-todo_deadline  { background:#fee2e2; color:#991b1b; }
.cat-issue_deadline { background:#fde68a; color:#92400e; }

/* Week-view grid */
.week-nav {
    display:flex; gap:.5rem; align-items:center;
    margin: 1rem 0;
}
.week-grid {
    display:grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap:.5rem;
    margin-bottom:1rem;
}
.day-col {
    background:#ffffff;
    border:1px solid #e2e8f0;
    border-radius:8px;
    min-height:220px;
    display:flex; flex-direction:column;
    overflow:hidden;
}
.day-col.is-today { border-color:#2563eb; box-shadow: 0 0 0 1px #2563eb inset; }
.day-head {
    padding:.5rem .65rem;
    background:#f1f5f9;
    border-bottom:1px solid #e2e8f0;
    display:flex; justify-content:space-between; align-items:baseline;
    font-size:.85rem;
}
.day-col.is-today .day-head { background:#dbeafe; }
.day-body {
    padding:.4rem;
    display:flex; flex-direction:column; gap:.3rem;
    flex:1;
}
.day-event {
    display:block;
    text-decoration:none;
    color:inherit;
    border-radius:6px;
    padding:.35rem .5rem;
    border-left:3px solid currentColor;
    font-size:.78rem;
    line-height:1.3;
    transition: transform .12s ease;
}
.day-event:hover { transform: translateY(-1px); }
.day-event .ev-time  { font-weight:600; font-size:.72rem; opacity:.85; }
.day-event .ev-title { font-weight:500; }
.day-event .ev-venue { font-size:.7rem; }

/* Booking row */
.booking-row {
    display:flex; justify-content:space-between; align-items:flex-start;
    padding:.65rem .75rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
    margin-bottom:.5rem;
}

/* Legend */
.legend {
    display:flex; flex-wrap:wrap; gap:.4rem;
}

/* Alert info variant */
.alert-info {
    background:#dbeafe; color:#1e3a8a;
    border:1px solid #bfdbfe;
    border-radius:8px;
    padding:.65rem .9rem;
    margin: .5rem 0;
}

/* hint text */
.hint {
    display:block;
    font-size:.78rem;
    color:#64748b;
    margin-top:.2rem;
}

/* Responsive: stack week grid on narrow screens */
@media (max-width: 900px) {
    .week-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .week-grid { grid-template-columns: 1fr; }
}

/* ========================================================================
   Phase 4: Meetings
   ====================================================================== */

/* Meeting status */
.badge-mstatus-scheduled { background:#dbeafe; color:#1e40af; }
.badge-mstatus-ongoing   { background:#fef3c7; color:#92400e; }
.badge-mstatus-completed { background:#dcfce7; color:#166534; }
.badge-mstatus-cancelled { background:#fee2e2; color:#991b1b; }

/* RSVP badges */
.badge-rsvp-pending   { background:#e2e8f0; color:#475569; }
.badge-rsvp-accept    { background:#dcfce7; color:#166534; }
.badge-rsvp-tentative { background:#fef3c7; color:#92400e; }
.badge-rsvp-decline   { background:#fee2e2; color:#991b1b; }

/* Attendance badges */
.badge-att-attended { background:#dcfce7; color:#166534; }
.badge-att-absent   { background:#fee2e2; color:#991b1b; }
.badge-att-late     { background:#fef3c7; color:#92400e; }

/* RSVP summary chip row */
.rsvp-summary {
    display:flex; flex-wrap:wrap; gap:.4rem;
    padding:.5rem .75rem;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    border-radius:8px;
}

/* Participant grid (meeting form) — internal participants with required toggle */
.participants-grid {
    display:grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap:.3rem;
    max-height:280px;
    overflow:auto;
    padding:.5rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
}
.participant-row {
    display:flex; align-items:center; gap:.5rem;
    padding:.25rem .4rem;
    border-radius:6px;
}
.participant-row:hover { background:#e2e8f0; }
.participant-row .check-item { flex:1; }
.participant-row .required-toggle {
    transition: opacity .15s ease;
    padding:.2rem .4rem;
    border:1px solid #cbd5e1;
    border-radius:6px;
    background:#fff;
}

/* Small select for inline forms */
.select-sm {
    font-size:.82rem;
    padding:.2rem .4rem;
}

/* ========================================================================
   Phase 5: Issue Tracker
   ====================================================================== */

/* Severity badges (S1=most critical=red, S5=trivial=gray) */
.badge-sev-1 { background:#fecaca; color:#7f1d1d; font-weight:700; }
.badge-sev-2 { background:#fed7aa; color:#7c2d12; }
.badge-sev-3 { background:#fde68a; color:#78350f; }
.badge-sev-4 { background:#bfdbfe; color:#1e3a8a; }
.badge-sev-5 { background:#e2e8f0; color:#475569; }

/* Issue status */
.badge-istatus-open                 { background:#dbeafe; color:#1e40af; }
.badge-istatus-in_progress          { background:#fef3c7; color:#92400e; }
.badge-istatus-pending_verification { background:#fde68a; color:#78350f; }
.badge-istatus-resolved             { background:#dcfce7; color:#166534; }
.badge-istatus-closed               { background:#e2e8f0; color:#334155; }

/* Attachment list */
.attach-list {
    list-style:none;
    padding:0;
    margin:0;
    display:flex;
    flex-direction:column;
    gap:.4rem;
}
.attach-item {
    display:flex;
    align-items:center;
    gap:.75rem;
    padding:.5rem .65rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
    transition: background .12s ease;
}
.attach-item:hover { background:#eff6ff; }
.attach-icon {
    font-size:1.4rem;
    flex-shrink:0;
}
.attach-info {
    flex:1;
    min-width:0;
    overflow:hidden;
}
.attach-info > a {
    display:inline-block;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    vertical-align:bottom;
}


/* ========================================================================
   Phase 6: Workflow
   ====================================================================== */

/* Workflow type badges */
.badge-wftype-surat_masuk  { background:#dbeafe; color:#1e40af; }
.badge-wftype-surat_keluar { background:#dcfce7; color:#166534; }
.badge-wftype-request      { background:#fef3c7; color:#92400e; }
.badge-wftype-disposisi    { background:#fce7f3; color:#9d174d; }

/* Workflow status */
.badge-wfstatus-open        { background:#dbeafe; color:#1e40af; }
.badge-wfstatus-in_progress { background:#fef3c7; color:#92400e; }
.badge-wfstatus-pending     { background:#e0e7ff; color:#3730a3; }
.badge-wfstatus-wf_end      { background:#dcfce7; color:#166534; }
.badge-wfstatus-cancelled   { background:#fee2e2; color:#991b1b; }

/* SLA color states */
.sla-ok     { color:#166534; }
.sla-soon   { color:#92400e; font-weight:600; }
.sla-breach { color:#991b1b; font-weight:700; }
.sla-na     { color:#64748b; }

/* Workflow timeline */
.wf-timeline {
    list-style:none;
    padding:0; margin:0;
    display:flex; flex-direction:column;
}
.wf-step {
    display:flex;
    gap:.75rem;
    padding:.6rem 0;
    border-left:2px solid #e2e8f0;
    margin-left:1rem;
    padding-left:1rem;
    position:relative;
}
.wf-step:first-child { padding-top:.2rem; }
.wf-step:last-child  { border-left-color: transparent; }

.wf-step-marker {
    position:absolute;
    left:-.85rem; top:.55rem;
    width:1.7rem; height:1.7rem;
    border-radius:50%;
    background:#e2e8f0;
    color:#475569;
    display:flex; align-items:center; justify-content:center;
    font-size:.85rem; font-weight:700;
    border:2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e1;
    flex-shrink:0;
}
.wf-step-done    .wf-step-marker { background:#22c55e; color:white; box-shadow:0 0 0 1px #16a34a; }
.wf-step-current .wf-step-marker { background:#2563eb; color:white; box-shadow:0 0 0 1px #1d4ed8; animation: pulse-blue 1.5s infinite; }
.wf-step-pending .wf-step-marker { background:#f1f5f9; color:#64748b; }

@keyframes pulse-blue {
    0%,100% { box-shadow: 0 0 0 1px #1d4ed8, 0 0 0 0 rgba(37,99,235,.45); }
    50%     { box-shadow: 0 0 0 1px #1d4ed8, 0 0 0 6px rgba(37,99,235,0); }
}

.wf-step-body { flex:1; min-width:0; }
.wf-step-head {
    display:flex; justify-content:space-between; align-items:baseline;
    gap:.5rem; flex-wrap:wrap;
    margin-bottom:.2rem;
}
.wf-step-times { margin-top:.15rem; }
.wf-step-notes {
    margin-top:.4rem;
    padding:.4rem .6rem;
    background:#f8fafc;
    border-left:3px solid #cbd5e1;
    border-radius:0 4px 4px 0;
    font-size:.85rem;
    white-space:pre-wrap;
}

/* Step-state badges */
.badge-wfstep-done    { background:#dcfce7; color:#166534; }
.badge-wfstep-current { background:#dbeafe; color:#1e40af; }
.badge-wfstep-pending { background:#e2e8f0; color:#475569; }

/* Route step block (form) */
.route-step {
    display:flex;
    gap:.5rem;
    align-items:flex-start;
    padding:.6rem;
    margin-bottom:.5rem;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
}
.route-step .step-num {
    flex-shrink:0;
    width:90px;
    font-weight:600;
    color:#475569;
    padding-top:.5rem;
}
.route-step .step-fields {
    flex:1;
    display:grid;
    grid-template-columns: 2fr 2fr 1fr 2fr;
    gap:.5rem;
    min-width:0;
}
.route-step .step-fields > label {
    display:flex;
    flex-direction:column;
    gap:.2rem;
    margin:0;
    font-size:.82rem;
}
.route-step .remove-step {
    flex-shrink:0;
    margin-top:.4rem;
}

@media (max-width:900px) {
    .route-step { flex-direction:column; }
    .route-step .step-fields { grid-template-columns: 1fr 1fr; }
}

/* ========================================================================
   Phase 7: Reports & Delegation
   ====================================================================== */

/* Report hub grid */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
}
.report-card {
    display: block;
    padding: .85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    text-decoration: none;
    color: inherit;
    transition: background .12s ease, transform .12s ease;
}
.report-card:hover {
    background: #eff6ff;
    transform: translateY(-2px);
    border-color: #93c5fd;
}
.report-code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .75rem;
    color: #64748b;
    font-weight: 600;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}
.report-name {
    font-weight: 600;
    color: #1e3a8a;
}

/* Key-value tile (used in reports) */
.kv {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .6rem 1rem;
}
.kv > div {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    font-size: .9rem;
}
.kv .muted {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Delegation status badges */
.badge-dst-pending   { background: #fef3c7; color: #92400e; }
.badge-dst-approved  { background: #dcfce7; color: #166534; }
.badge-dst-rejected  { background: #fee2e2; color: #991b1b; }
.badge-dst-cancelled { background: #e2e8f0; color: #475569; }
.badge-dst-expired   { background: #e0e7ff; color: #3730a3; }

