/* ===============================================================
   Project Report Generator  v 7.3
   Tamhane Ghadage & Company  -  Chartered Accountants
   =============================================================== */

:root {
    --navy: #1a3e6b;
    --navy-dark: #14305a;
    --navy-light: #2c5a8f;
    --gold: #e67e22;
    --gold-light: #f1b24a;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-soft: #f0f4f9;
    --border: #e0e7f1;
    --border-strong: #c7d2e0;
    --text: #1c2330;
    --muted: #6b7785;
    --success: #16a34a;
    --danger:  #dc2626;
    --warn:    #d97706;

    --shadow-sm: 0 1px 2px rgba(20,48,90,.06);
    --shadow:    0 4px 14px rgba(20,48,90,.08);
    --shadow-lg: 0 12px 28px rgba(20,48,90,.14);

    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ===================== TOP BAR ===================== */
.topbar {
    background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 60%, #3a72ad 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 56px; height: 56px;
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.25);
    border-radius: 10px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-family: 'Times New Roman', serif;
    font-weight: 800;
    font-size: 22px;
    color: #ffffff;
    line-height: 1;
}
.brand-mark span {
    font-size: 8px;
    letter-spacing: 2px;
    color: var(--gold-light);
    margin-top: 2px;
}
.brand-text h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff;
}
.brand-text h1 .ver {
    color: var(--gold-light);
    font-weight: 600;
    font-size: 14px;
    margin-left: 6px;
}
.brand-text p { margin: 2px 0 0 0; font-size: 12.5px; color: #cfdbeb; }

.contact { text-align: right; font-size: 12.5px; line-height: 1.6; opacity: .92; }
.contact b { color: var(--gold-light); }

/* ===================== SHELL LAYOUT ===================== */
.shell {
    max-width: 1400px;
    margin: 22px auto;
    padding: 0 22px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 22px;
    align-items: start;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: #ffffff;
    border-radius: var(--radius);
    padding: 16px 12px;
    position: sticky;
    top: 90px;
    box-shadow: var(--shadow);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: #d5e0ee;
    padding: 11px 12px;
    text-align: left;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s ease;
    font-family: inherit;
}
.nav-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.nav-item.active {
    background: rgba(255,255,255,.14);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--gold-light);
    font-weight: 600;
}
.nav-item .num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-item.active .num { background: var(--gold); }

.tally-card {
    margin-top: 18px;
    padding: 12px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
}
.tally-label { font-size: 11px; letter-spacing: 1.5px; color: var(--gold-light); font-weight: 700; }
.tally-status { font-size: 16px; font-weight: 700; margin: 4px 0; }
.tally-status.ok   { color: #6cf08a; }
.tally-status.bad  { color: #ff9a9a; }
.tally-detail { font-size: 11.5px; color: #d5e0ee; opacity: .9; }

.side-actions {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 14px;
}

.side-footer {
    margin-top: 16px;
    text-align: center;
    font-size: 10.5px;
    color: #aebfd4;
    opacity: .85;
    letter-spacing: 1px;
}

.side-user {
    margin-top: 16px;
    padding: 10px 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    text-align: center;
}
.side-user-name {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.side-user-logout {
    color: var(--gold-light) !important;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
}
.side-user-logout:hover { color: #ffd592 !important; }

/* ===================== WORKSPACE ===================== */
.workspace { min-width: 0; }
.tab { display: none; animation: fadeIn .22s ease-out; }
.tab.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.workspace h2 {
    color: var(--navy);
    font-size: 24px;
    margin: 4px 0 18px 0;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--navy);
    font-weight: 700;
    letter-spacing: .2px;
}
.workspace h3 {
    color: var(--navy);
    font-size: 15.5px;
    margin: 0 0 12px 0;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* ===================== CARDS / GRID ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ===================== INPUTS ===================== */
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 10px 0 4px 0;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.input {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26,62,107,.12);
}
textarea.input { resize: vertical; min-height: 70px; }
select.input { cursor: pointer; }

.info {
    background: #fff8eb;
    color: #6b4d10;
    border-left: 3px solid var(--gold);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 14px;
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: all .15s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}
.btn:hover:not(:disabled) {
    background: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(230,126,34,.3);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--navy); }
.btn-danger  { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; box-shadow: 0 5px 12px rgba(220,38,38,.25); }
.btn-ghost {
    background: var(--bg-soft);
    color: var(--navy);
    border: 1px solid var(--border-strong);
    box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
    background: #e4ecf6;
    color: var(--navy-dark);
    border-color: var(--navy);
    transform: none;
    box-shadow: none;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===================== DATA TABLES ===================== */
.data-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
    margin-bottom: 8px;
    background: #fff;
}
.data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.data-table th {
    background: var(--bg-soft);
    color: var(--navy);
    padding: 9px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-strong);
    position: sticky;
    top: 0;
}
.data-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border);
}
.data-table td.numeric { text-align: right; }
.data-table input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
}
.data-table input:focus {
    outline: none;
    border-color: var(--navy);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(26,62,107,.1);
}
.data-table .del-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.data-table .del-btn:hover { background: #fee2e2; }
.data-table td.action-col { width: 36px; text-align: center; }

/* ===================== REPORT PREVIEW ===================== */
.report-preview-card { padding: 14px; }
#reportFrame {
    width: 100%;
    height: 800px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
}

/* ===================== MISC ===================== */
.muted { color: var(--muted); font-size: 13px; }
.msg { margin-top: 12px; font-size: 13.5px; }
.msg.ok  { color: var(--success); font-weight: 600; }
.msg.err { color: var(--danger);  font-weight: 600; }

/* ===================== FOOTER ===================== */
.footer {
    max-width: 1400px;
    margin: 40px auto 16px auto;
    padding: 16px 28px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* ===================== LOGIN PAGE ===================== */
.login-body {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    margin: 0;
}
.login-shell {
    width: 100%;
    max-width: 420px;
}
.login-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 36px 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    border-top: 4px solid var(--gold);
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}
.login-mark {
    width: 56px; height: 56px;
    background: var(--navy);
    border-radius: 10px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-family: 'Times New Roman', serif;
    font-weight: 800;
    font-size: 22px;
    color: #ffffff;
    line-height: 1;
}
.login-mark span {
    font-size: 8px;
    letter-spacing: 2px;
    color: var(--gold-light);
    margin-top: 2px;
}
.login-firm {
    font-weight: 700;
    color: var(--navy);
    font-size: 15px;
}
.login-firm-sub {
    color: var(--muted);
    font-size: 12px;
}
.login-title {
    color: var(--navy);
    font-size: 22px;
    margin: 4px 0 4px 0;
    font-weight: 700;
}
.login-sub {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 22px 0;
}
.login-error {
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 18px;
}
.login-submit {
    width: 100%;
    margin-top: 18px;
    justify-content: center;
}
.login-footer {
    margin-top: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 11.5px;
    letter-spacing: 1px;
}

/* ===================== PREFILL CARD ===================== */
.prefill-card {
    background: linear-gradient(135deg, #fff8eb 0%, #ffffff 60%);
    border-left: 4px solid var(--gold);
}
.prefill-meta {
    margin-top: 12px;
    display: none;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--success);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #14532d;
}
.prefill-meta.show { display: block; }
.prefill-meta b { color: #052e16; }
.prefill-meta .chip {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    padding: 2px 8px;
    border-radius: 999px;
    margin-right: 6px;
    font-size: 12px;
}

/* ===================== TOAST ===================== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--navy);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all .25s ease;
    z-index: 1000;
    max-width: 340px;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok   { background: var(--success); }
.toast.err  { background: var(--danger); }
.toast.warn { background: var(--warn); }
