/* ===========================
   Daily Work Follow-Up Tracker
   =========================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
    --color-primary: #0b5cab;
    --color-primary-dark: #084a8a;
    --color-primary-light: #e8f1fb;
    --color-bg: #f4f6f9;
    --color-surface: #ffffff;
    --color-border: #d9dee4;
    --color-text: #1f2933;
    --color-text-muted: #5a6573;
    --color-success: #1f7a3a;
    --color-warning: #b8860b;
    --color-danger: #c0392b;
    --color-info: #2563eb;

    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(15,30,60,0.06);
    --shadow-lg: 0 12px 32px rgba(15,30,60,0.25);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
}
body.modal-open { overflow: hidden; }

/* ---------- Header ---------- */
.app-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    padding: 22px 0;
    box-shadow: var(--shadow-md);
}
.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.header-text { flex: 1 1 auto; min-width: 240px; }
.app-header h1 { margin: 0; font-size: 1.75rem; font-weight: 600; letter-spacing: 0.3px; }
.app-header .subtitle { margin: 6px 0 0; font-size: 0.95rem; opacity: 0.92; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn-header-primary {
    background: #fff;
    color: var(--color-primary-dark);
    border: 1px solid #fff;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 0.92rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.btn-header-primary:hover { background: var(--color-primary-light); }
.btn-header-primary:active { transform: translateY(1px); }

.btn-header-secondary {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.55);
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-header-secondary:hover { background: rgba(255,255,255,0.22); }
.btn-header-secondary .caret { font-size: 0.8rem; }

/* Info icon button */
.btn-header-icon {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.55);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
    font-family: inherit;
    padding: 0;
}
.btn-header-icon:hover { background: rgba(255,255,255,0.25); transform: scale(1.06); }
.btn-header-icon:active { transform: scale(0.96); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    color: var(--color-text);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    z-index: 800;
    animation: ddIn 0.15s ease;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 10px 16px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
}
.dropdown-item:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }
.dropdown-item-danger { color: var(--color-danger); }
.dropdown-item-danger:hover { background: #fef2f2; color: var(--color-danger); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 4px 0; }
.dd-icon { display: inline-block; width: 18px; text-align: center; font-size: 0.95rem; }

@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Container ---------- */
.container { max-width: 1300px; margin: 0 auto; padding: 24px; }

/* ---------- Cards ---------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}

/* ---------- Summary cards ---------- */
.summary-section { margin-bottom: 20px; }
.summary-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.summary-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 6px;
    border-left: 4px solid var(--color-primary);
    transition: transform 0.15s ease;
}
.summary-card:hover { transform: translateY(-2px); }
.card-label { font-size: 0.8rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.card-value { font-size: 1.75rem; font-weight: 700; color: var(--color-text); }
.card-total       { border-left-color: var(--color-primary); }
.card-not-started { border-left-color: #6b7280; }
.card-in-progress { border-left-color: #2563eb; }
.card-waiting     { border-left-color: #d97706; }
.card-completed   { border-left-color: var(--color-success); }
.card-overdue     { border-left-color: var(--color-danger); }

/* ---------- ONE-ROW FILTER TOOLBAR ---------- */
.toolbar-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}
.toolbar-row > * { min-width: 0; }
.filter-search { flex: 2 1 220px; }
.filter-select { flex: 1 1 130px; }

/* ---------- Form ---------- */
.form-info-banner {
    background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.form-info-banner .info-label { font-weight: 700; color: var(--color-primary-dark); }
#task-id-preview {
    font-family: ui-monospace, "SF Mono", Consolas, Monaco, monospace;
    color: var(--color-text);
    font-weight: 600;
}

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field-wide { grid-column: span 2; }
.form-field-full { grid-column: 1 / -1; }
.form-field label { font-size: 0.85rem; font-weight: 600; color: var(--color-text); }
.req { color: var(--color-danger); }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(11,92,171,0.15);
}
textarea { resize: vertical; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-secondary { background: #fff; color: var(--color-primary); border-color: var(--color-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--color-primary-light); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #962d22; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; }

/* ---------- Table ---------- */
.table-wrapper { overflow-x: auto; }
.tasks-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 1100px; }
.tasks-table thead { background: var(--color-primary-light); }
.tasks-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--color-primary-dark);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
.tasks-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
    word-break: break-word;
}
.tasks-table tbody tr:hover { background: #f8fafc; }
.tasks-table tbody tr.row-overdue { background: #fef2f2; }
.tasks-table tbody tr.row-overdue:hover { background: #fde8e8; }

/* ---------- Priority ---------- */
.priority {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    min-width: 28px;
    text-align: center;
}
.priority-P1 { background: var(--color-danger); }
.priority-P2 { background: #e67e22; }
.priority-P3 { background: #27ae60; }

/* ---------- Status badge ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-not-started { background: #e5e7eb; color: #374151; }
.badge-in-progress { background: #dbeafe; color: #1e40af; }
.badge-waiting     { background: #fef3c7; color: #92400e; }
.badge-completed   { background: #d1fae5; color: #065f46; }
.badge-overdue     { background: var(--color-danger); color: #fff; margin-left: 4px; }

.empty-state { text-align: center; color: var(--color-text-muted); padding: 30px 10px; font-style: italic; }

/* ---------- Footer ---------- */
.app-footer {
    margin-top: 30px;
    padding: 18px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
    background: #fff;
}

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   MODAL / POPUP
   ===================================================== */
.modal {
    position: fixed; inset: 0;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.18s ease;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.modal-dialog {
    position: relative;
    background: var(--color-surface);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: popIn 0.22s ease;
}
.modal-xs   { max-width: 400px; }
.modal-sm   { max-width: 460px; }
.modal-lg   { max-width: 880px; }
.modal-info { max-width: 720px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
}
.modal-close:hover { background: rgba(255,255,255,0.15); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-body p { margin: 0 0 12px; color: var(--color-text); }
.modal-body p:last-child { margin-bottom: 0; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 22px;
    background: #f8fafc;
    border-top: 1px solid var(--color-border);
}

.info-row {
    display: flex; justify-content: space-between;
    padding: 8px 12px;
    background: var(--color-primary-light);
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.92rem;
}
.info-label { font-weight: 600; color: var(--color-primary-dark); }
.hint { font-size: 0.85rem; color: var(--color-text-muted); font-style: italic; }
.warn-text {
    font-size: 0.88rem; color: var(--color-danger); font-weight: 600;
    background: #fef2f2; padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--color-danger);
}

.file-drop {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    border: 2px dashed var(--color-border);
    border-radius: 6px;
    background: #fafbfc;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.file-name { font-size: 0.9rem; color: var(--color-text-muted); word-break: break-all; flex: 1; }
.file-name.has-file { color: var(--color-success); font-weight: 600; }

/* ---------- Message Modal ---------- */
.message-body {
    display: flex; align-items: center; gap: 16px;
    padding: 24px 22px;
}
.message-icon {
    flex-shrink: 0;
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}
.message-body p { margin: 0; font-size: 0.95rem; color: var(--color-text); line-height: 1.5; }
#message-header.msg-success { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
#message-header.msg-error   { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
#message-header.msg-info    { background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%); }
#message-header.msg-warning { background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%); }
.message-icon.msg-success { background: #10b981; }
.message-icon.msg-error   { background: #ef4444; }
.message-icon.msg-info    { background: var(--color-primary); }
.message-icon.msg-warning { background: #f59e0b; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =====================================================
   INFO / ABOUT MODAL - dark themed (like reference image)
   ===================================================== */
.info-theme .modal-dialog {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #1e293b;
}

/* Header */
.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid #1e293b;
}
.info-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.info-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}
.info-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
}
.info-tagline {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
}
.info-close { color: #cbd5e1; }
.info-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Body */
.info-body {
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px 22px;
    overflow-y: auto;
}
.info-body p { color: #cbd5e1; }

/* Metadata list */
.info-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
    background: #111c31;
}
.info-list li {
    display: grid;
    grid-template-columns: 28px 130px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #1e293b;
    font-size: 0.88rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list .ico {
    color: #60a5fa;
    text-align: center;
    font-size: 0.95rem;
}
.info-list .lbl {
    color: #94a3b8;
    font-weight: 500;
}
.info-list .val {
    color: #f1f5f9;
    font-weight: 500;
    word-break: break-word;
}

/* Important / Note box */
.info-note {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.info-note h3 {
    margin: 0 0 10px;
    color: #fbbf24;
    font-size: 0.95rem;
    font-weight: 700;
}
.info-note ul {
    margin: 0;
    padding-left: 20px;
    color: #fde68a;
    font-size: 0.85rem;
    line-height: 1.7;
}
.info-note ul li { margin-bottom: 4px; }
.info-note strong { color: #fff; }

/* Sections */
.info-section { margin-bottom: 18px; }
.info-section h3 {
    margin: 0 0 10px;
    color: #60a5fa;
    font-size: 0.98rem;
    font-weight: 700;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 6px;
}
.info-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.info-feature-list.two-col {
    grid-template-columns: 1fr 1fr;
}
.info-feature-list li {
    position: relative;
    padding-left: 22px;
    font-size: 0.86rem;
    color: #cbd5e1;
    line-height: 1.5;
}
.info-feature-list li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    top: 0;
    color: #10b981;
    font-weight: 700;
}
.info-feature-list code,
.info-note code,
.info-section code {
    background: #1e293b;
    color: #93c5fd;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: ui-monospace, "SF Mono", Consolas, Monaco, monospace;
}

.info-browsers {
    background: #111c31;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.88rem;
    color: #cbd5e1;
    text-align: center;
    margin: 0;
}

/* Footer */
.info-footer {
    background: #0b1220;
    border-top: 1px solid #1e293b;
    color: #cbd5e1;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.info-copyright {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.45;
}
.info-tiny {
    font-size: 0.75rem;
    color: #64748b;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1100px) {
    .summary-cards { grid-template-columns: repeat(3, 1fr); }
    .form-grid { grid-template-columns: repeat(3, 1fr); }
    .form-field-wide { grid-column: span 2; }
}
@media (max-width: 900px) {
    .toolbar-row { flex-wrap: wrap; }
    .filter-search { flex: 1 1 100%; }
    .filter-select { flex: 1 1 calc(50% - 5px); }
}
@media (max-width: 768px) {
    .app-header h1 { font-size: 1.35rem; }
    .header-inner { gap: 12px; }
    .header-actions { width: 100%; justify-content: flex-start; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-field-wide, .form-field-full { grid-column: 1 / -1; }
    .modal { padding: 10px; }
    .modal-lg, .modal-sm, .modal-xs, .modal-info { max-width: 100%; }
    .modal-footer { flex-direction: column-reverse; }
    }
/* =====================================================
   Encryption UI
   ===================================================== */
.encrypt-section {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-primary-dark);
    font-size: 0.9rem;
}
.checkbox-row input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.password-wrap {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.password-input-row {
    position: relative;
    display: flex;
    gap: 6px;
}
.password-input-row input { flex: 1; padding-right: 38px; }
.password-input-row .btn-icon {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px 8px;
    color: var(--color-text-muted);
    border-radius: 4px;
}
.password-input-row .btn-icon:hover { color: var(--color-primary); background: var(--color-primary-light); }

/* Password strength bar */
.pwd-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
}
.pwd-strength-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.pwd-strength-bar span {
    display: block;
    height: 100%;
    width: 0%;
    transition: width 0.25s ease, background 0.25s ease;
    background: #ef4444;
}
.pwd-strength.s1 .pwd-strength-bar span { width: 25%; background: #ef4444; }
.pwd-strength.s2 .pwd-strength-bar span { width: 50%; background: #f59e0b; }
.pwd-strength.s3 .pwd-strength-bar span { width: 75%; background: #3b82f6; }
.pwd-strength.s4 .pwd-strength-bar span { width: 100%; background: #10b981; }
.pwd-strength-label {
    min-width: 70px;
    font-weight: 600;
    color: var(--color-text-muted);
}
.pwd-strength.s1 .pwd-strength-label { color: #ef4444; }
.pwd-strength.s2 .pwd-strength-label { color: #f59e0b; }
.pwd-strength.s3 .pwd-strength-label { color: #3b82f6; }
.pwd-strength.s4 .pwd-strength-label { color: #10b981; }

/* Encrypted file banner in import modal */
.encrypted-banner {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-left: 4px solid #f59e0b;
    color: #92400e;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.88rem;
    margin-bottom: 10px;
}
