/* College ERP interface styles.
   Built for people who sit in this software all day: dense but calm, with
   numbers that line up and colour reserved for meaning rather than decoration. */

:root {
    --ink:        #1B2A33;
    --ink-soft:   #4A5C68;
    --ink-faint:  #7A8A95;
    --canvas:     #EDF0F3;
    --surface:    #FFFFFF;
    --line:       #DCE3E8;
    --line-soft:  #EAEFF2;

    --accent:     #0D6E5F;
    --accent-dk:  #095449;
    --accent-bg:  #E6F2EF;

    --due:        #A6321E;
    --due-bg:     #FBEAE6;
    --warn:       #8A6008;
    --warn-bg:    #FBF2DD;

    --sidebar-w:  248px;
    --radius:     6px;
    --radius-sm:  4px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Rupee amounts, admission numbers, dates and counts all read as columns.
   Tabular figures keep them aligned digit over digit. */
table, .num, input, select, .stat-value { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 { margin: 0 0 4px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p  { margin: 0 0 12px; }
a  { color: var(--accent-dk); }
a:hover { color: var(--accent); }

/* ---------- Shell ---------- */

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

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--ink);
    color: #C6D2DA;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    color: #fff;
    text-decoration: none;
    text-align: center;
}
.brand img {
    width: 54px; height: 54px; object-fit: contain;
    background: #fff; border-radius: var(--radius-sm); padding: 4px;
}
.brand-mark {
    width: 54px; height: 54px; border-radius: var(--radius-sm);
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 19px;
}
.brand-text { width: 100%; }
/* The full institution name is shown across up to three lines rather than
   truncated -- a college's name is how staff confirm they are in the right
   system, so cutting it off mid-word is worse than the extra height. */
.brand-name {
    display: block;
    font-size: 13px; font-weight: 600; color: #fff;
    line-height: 1.35;
    overflow-wrap: break-word;
}
.brand-sub { display: block; font-size: 11.5px; color: #8FA3AF; margin-top: 2px; }

.nav { padding: 10px 0 24px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group-label {
    padding: 0 18px 5px;
    font-size: 11.5px;
    color: #7B8F9C;
    letter-spacing: 0.02em;
}
.nav a {
    display: block;
    padding: 7px 18px;
    color: #C6D2DA;
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,0.055); color: #fff; }
.nav a.active {
    background: rgba(255,255,255,0.085);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 500;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 12px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft); }
.topbar-user .role {
    background: var(--canvas); border: 1px solid var(--line);
    padding: 1px 7px; border-radius: 20px; font-size: 11.5px; color: var(--ink-soft);
}

.content { padding: 22px 26px 48px; max-width: 1180px; width: 100%; }

.menu-toggle { display: none; }

/* ---------- Panels ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin: -2px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-note { color: var(--ink-faint); font-size: 12.5px; }

.card-danger { border-left: 3px solid var(--due); }
.card-quiet  { background: transparent; border-style: dashed; }

.page-head { margin-bottom: 18px; }
.page-head p { color: var(--ink-soft); margin: 2px 0 0; }

/* ---------- Tables ---------- */

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th {
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody tr:last-child td, table tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFCFD; }
td.amount, th.amount { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

.empty { color: var(--ink-faint); padding: 18px 10px; text-align: center; }

/* ---------- Forms ---------- */

label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-soft); }
label > input, label > select, label > textarea { margin-top: 3px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=tel], input[type=url], input[type=file], select, textarea {
    padding: 7px 9px;
    border: 1px solid #C4CFD6;
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 360px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: auto; }

.field-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field-row label { margin-bottom: 0; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.field-grid label { margin-bottom: 0; }
.field-grid input, .field-grid select { max-width: 100%; }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }

fieldset { border: none; border-top: 1px solid var(--line-soft); margin: 20px 0 0; padding: 16px 0 0; }
legend { font-weight: 600; font-size: 14px; padding: 0 8px 0 0; color: var(--ink); }

/* ---------- Buttons ---------- */

button, .btn {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}
button:hover, .btn:hover { background: var(--accent-dk); border-color: var(--accent-dk); color: #fff; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn-secondary {
    background: #fff; color: var(--ink); border-color: #C4CFD6;
}
.btn-secondary:hover { background: var(--canvas); color: var(--ink); border-color: var(--ink-faint); }

.btn-danger { background: var(--due); border-color: var(--due); }
.btn-danger:hover { background: #872718; border-color: #872718; }

.btn-small { padding: 4px 10px; font-size: 12.5px; }

/* An action that lives inside a table row and reads as a link, not a button. */
.link-action {
    background: none; border: none; padding: 0;
    color: var(--due); text-decoration: underline; cursor: pointer;
    font-size: 13px; font-family: inherit; font-weight: 400;
}
.link-action:hover { background: none; color: #872718; }

.row-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.row-actions .sep { color: var(--line); }

/* ---------- Messages ---------- */

.error, .success, .banner {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid transparent;
}
.error   { background: var(--due-bg);   color: var(--due);   border-color: #F0CFC7; }
.success { background: var(--accent-bg); color: var(--accent-dk); border-color: #BFDED7; }
.banner  { background: var(--warn-bg);  color: var(--warn);  border-color: #EBDCB4; }

/* ---------- Status and figures ---------- */

.tag {
    display: inline-block; padding: 1px 8px; border-radius: 20px;
    font-size: 11.5px; font-weight: 500; border: 1px solid transparent; white-space: nowrap;
}
.tag-paid    { background: var(--accent-bg); color: var(--accent-dk); border-color: #BFDED7; }
.tag-due     { background: var(--due-bg);    color: var(--due);       border-color: #F0CFC7; }
.tag-partial { background: var(--warn-bg);   color: var(--warn);      border-color: #EBDCB4; }
.tag-muted   { background: var(--canvas);    color: var(--ink-faint); border-color: var(--line); }

.money-due  { color: var(--due); font-weight: 600; }
.money-paid { color: var(--accent-dk); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px;
}
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

code {
    background: var(--canvas); border: 1px solid var(--line);
    padding: 1px 5px; border-radius: 3px; font-size: 12.5px;
}

nav.tabs { margin-bottom: 16px; display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
nav.tabs a {
    padding: 7px 12px; color: var(--ink-soft); text-decoration: none;
    font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
nav.tabs a:hover { color: var(--ink); }
nav.tabs a.active { color: var(--accent-dk); border-bottom-color: var(--accent); font-weight: 500; }

.logo-preview {
    width: 76px; height: 76px; object-fit: contain;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; padding: 5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%; flex: none; height: auto; position: static;
    }
    /* Checkbox toggle keeps the mobile menu working without JavaScript. */
    .nav { display: none; }
    #nav-toggle:checked ~ .shell .nav { display: block; }
    .menu-toggle {
        display: block; cursor: pointer; padding: 14px 18px;
        color: #fff; font-size: 13.5px; border-bottom: 1px solid rgba(255,255,255,0.09);
    }
    /* On a phone the sidebar collapses to a bar, so the brand sits inline
       again and the stacked treatment is dropped. */
    .brand {
        display: flex; flex-direction: row; align-items: center; text-align: left;
        border-bottom: none; padding: 12px 16px; gap: 10px;
    }
    .brand img, .brand-mark {
        width: 36px; height: 36px; font-size: 14px;
        margin: 0; flex: 0 0 36px;
    }
    .brand-name { font-size: 13px; }
    .sidebar-head { display: flex; align-items: center; justify-content: space-between; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    input[type=text], input[type=email], input[type=password], input[type=date],
    input[type=number], input[type=tel], input[type=url], select, textarea { max-width: 100%; }
    .table-scroll { margin: 0 -20px; padding: 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@media print {
    .sidebar, .topbar { display: none; }
    body { background: #fff; }
    .content { padding: 0; max-width: none; }
    .card { border: none; padding: 0; }
}
