:root {
  --ink: #18362f;
  --muted: #71807a;
  --paper: #f6f3ea;
  --card: #fffef9;
  --line: #dedfd6;
  --green: #1f594b;
  --lime: #dbe85d;
  --shadow: 0 18px 50px rgba(31, 61, 51, .09);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid rgba(24,54,47,.13); background: rgba(246,243,234,.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.brand { display:flex; gap: 11px; align-items:center; color:var(--ink); text-decoration:none; font-family:Manrope,sans-serif; font-size:13px; line-height:1.05; font-weight:800; letter-spacing:-.02em; }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; color:var(--paper); background:var(--green); border-radius:50% 50% 46% 54% / 42% 57% 43% 58%; font-size:20px; }
.header-actions { display:flex; gap:9px; }
.button { border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:9px; padding:10px 15px; font-weight:700; transition:.2s ease; }
.button:hover { transform:translateY(-1px); box-shadow:0 5px 14px rgba(20,60,48,.10); }
.button:disabled, button:disabled, select:disabled, input:disabled, .import-label.disabled { cursor:not-allowed; opacity:.45; transform:none; box-shadow:none; }
.import-label.disabled { pointer-events:none; }
.button.primary { background:var(--green); color:#fff; border-color:var(--green); }
.button.ghost { background:transparent; }
.outline-action { border-width:2px; }
.positive-outline { color:var(--green); border-color:rgba(31,89,75,.48); }
.positive-outline:hover { background:rgba(31,89,75,.055); }
.import-label input { display:none; }
main { padding: 44px clamp(18px, 5vw, 72px) 70px; }
.section-label { color:#77877f; font-size:11px; letter-spacing:.18em; font-weight:800; margin:0 0 15px; }
.workspace { max-width:1500px; margin:auto; background:var(--card); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow); overflow:hidden; }
.semester-bar { padding:26px 30px 22px; display:flex; justify-content:space-between; align-items:end; border-bottom:1px solid var(--line); }
.semester-title-row { display:flex; align-items:center; gap:8px; }
#semesterSelect { appearance:none; border:0; background:transparent; font:800 28px Manrope,sans-serif; color:var(--ink); padding:0 29px 0 0; background-image:linear-gradient(45deg,transparent 50%,var(--ink) 50%),linear-gradient(135deg,var(--ink) 50%,transparent 50%); background-position:calc(100% - 10px) 52%,calc(100% - 4px) 52%; background-size:6px 6px; background-repeat:no-repeat; }
.icon-button { border:0; background:transparent; color:var(--muted); font-size:20px; padding:5px; }
.semester-actions { display:flex; align-items:center; gap:9px; }
.term-action { display:inline-flex; align-items:center; justify-content:center; min-height:40px; padding:10px 14px; font-size:14px; line-height:1; white-space:nowrap; }
.danger-button { color:#a74747; border-color:rgba(167,71,71,.35); }
.danger-button:hover { background:rgba(167,71,71,.06); box-shadow:0 5px 14px rgba(167,71,71,.10); }
.button.danger-primary { color:#fff; background:#a74747; border-color:#a74747; }
.button.danger-primary:hover { background:#923b3b; border-color:#923b3b; box-shadow:0 6px 16px rgba(167,71,71,.2); }
.text-button { border:0; background:transparent; color:var(--green); font-weight:800; padding:6px 0; }
.danger-text { color:#a74747; }
.stats { display:grid; grid-template-columns:repeat(4,1fr); border-bottom:1px solid var(--line); }
.stat { padding:23px 30px; border-right:1px solid var(--line); }
.stat:last-child { border-right:0; }
.stat-value { font:800 30px Manrope,sans-serif; letter-spacing:-.04em; }
.stat-label { color:var(--muted); font-size:12px; margin-top:3px; }
.toolbar { display:flex; gap:10px; padding:19px 22px; border-bottom:1px solid var(--line); }
.search-wrap { flex:1; min-width:200px; position:relative; }
.search-wrap span { position:absolute; left:13px; top:9px; font-size:22px; color:#7b8a84; }
.toolbar input,.toolbar select,.form-grid input,.form-grid select,.form-grid textarea,.small-modal input { width:100%; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:#fbfaf5; padding:10px 12px; outline:none; }
.toolbar input { padding-left:39px; }
.toolbar select { width:auto; min-width:160px; }
input:focus,select:focus,textarea:focus { border-color:#78998d!important; box-shadow:0 0 0 3px rgba(54,109,91,.11); }
.table-shell { min-height:220px; overflow-x:auto; }
table { border-collapse:collapse; width:100%; }
@media (min-width:851px) { table { min-width:1250px; } }
th { text-align:left; color:#7c8b85; font-size:10px; letter-spacing:.12em; text-transform:uppercase; padding:15px 20px; border-bottom:1px solid var(--line); }
td { padding:18px 20px; border-bottom:1px solid #e8e8e0; font-size:14px; vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tbody tr { transition:background .15s; }
tbody tr:hover { background:#faf9f3; }
.person { font-weight:800; }
.notes-cell { color:var(--muted); min-width:180px; max-width:320px; white-space:normal; overflow-wrap:anywhere; line-height:1.45; }
.badge { display:inline-flex; align-items:center; gap:7px; border-radius:99px; padding:6px 9px; font-size:11px; font-weight:800; white-space:nowrap; }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.status-pending { color:#8a651d; background:#fff0bd; }
.status-follow-up-sent { color:#825b13; background:#f6dc91; }
.status-rejected-no-response { color:#955044; background:#f6d8d2; }
.status-rejected-no-position { color:#a13f4f; background:#f4ced5; }
.status-rejected-weak-background { color:#7f3c62; background:#eed2e1; }
.status-positive-funded { color:#146147; background:#ccebd8; }
.status-positive-unfunded { color:#176367; background:#cde8e7; }
.status-withdrawn { color:#59645f; background:#e1e5e2; }
.email-link { color:#2f6758; text-decoration:none; overflow-wrap:anywhere; }
.email-link:hover { text-decoration:underline; }
.row-actions { display:flex; justify-content:flex-end; gap:4px; }
.row-button { border:0; background:transparent; color:#74837d; padding:7px; border-radius:6px; }
.row-button:hover { background:#ecefe9; color:var(--ink); }
.empty-state { padding:54px 20px 62px; text-align:center; }
.empty-icon { margin:auto; width:48px; height:48px; display:grid; place-items:center; background:#eef2d3; border-radius:50%; font-size:22px; }
.empty-state h2 { font:800 22px Manrope,sans-serif; margin:15px 0 7px; }
.empty-state p { color:var(--muted); margin:0 0 20px; }
.modal { width:min(680px,calc(100% - 28px)); border:0; border-radius:18px; padding:0; color:var(--ink); background:var(--card); box-shadow:0 24px 80px rgba(10,35,29,.28); }
.modal::backdrop { background:rgba(20,43,37,.48); backdrop-filter:blur(3px); }
.modal form { padding:27px; }
.modal-head { display:flex; justify-content:space-between; align-items:start; margin-bottom:22px; }
.modal h2 { font:800 27px Manrope,sans-serif; margin:0; }
.close-button { border:0; background:transparent; color:var(--muted); font-size:29px; line-height:1; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-grid label,.small-modal label { display:grid; gap:7px; font-size:12px; font-weight:800; }
.form-grid .full { grid-column:1/-1; }
.form-grid textarea { resize:vertical; }
.history-section { border-top:1px solid var(--line); margin-top:6px; padding-top:19px; }
.history-head { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.history-head .section-label { margin-bottom:4px; }
.history-head h3 { font:800 18px Manrope,sans-serif; margin:0; }
.compact-button { padding:8px 11px; font-size:12px; }
.contact-composer { margin-top:14px; display:grid; grid-template-columns:140px 150px 1fr; gap:10px; padding:14px; border:1px solid var(--line); border-radius:11px; background:#f7f7f1; }
.contact-composer[hidden] { display:none; }
.contact-composer label { display:grid; gap:6px; font-size:11px; font-weight:800; }
.contact-composer input,.contact-composer select { width:100%; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:#fffef9; padding:9px 10px; }
.composer-actions { grid-column:1/-1; display:flex; justify-content:flex-end; align-items:center; gap:12px; }
.history-list { display:grid; gap:8px; margin-top:14px; }
.history-empty { color:var(--muted); font-size:13px; padding:13px 0; }
.history-item { display:grid; grid-template-columns:105px 120px 1fr auto; gap:12px; align-items:start; padding:11px 12px; border:1px solid #e5e6de; border-radius:9px; background:#fbfaf5; }
.history-date { font-size:12px; color:var(--muted); }
.history-type { font-size:11px; font-weight:800; color:var(--green); }
.history-summary { font-size:13px; line-height:1.4; overflow-wrap:anywhere; }
.history-remove { border:0; background:transparent; color:#9a5c5c; font-size:17px; line-height:1; }
.modal-actions { display:flex; justify-content:flex-end; gap:9px; padding-top:23px; }
.small-modal { width:min(450px,calc(100% - 28px)); }
.confirm-modal { width:min(470px,calc(100% - 28px)); }
.confirm-dialog-content { display:grid; grid-template-columns:48px 1fr; gap:16px; padding:28px; }
.confirm-dialog-content .section-label { margin-bottom:8px; color:#9a5a55; }
.confirm-icon { width:48px; height:48px; display:grid; place-items:center; border-radius:50%; background:#fae5e2; color:#a74747; font:800 23px Manrope,sans-serif; }
.confirm-description { margin:9px 0 0; color:var(--muted); font-size:14px; line-height:1.55; }
.confirm-dialog-content .modal-actions { grid-column:1/-1; padding-top:8px; }
.toast { position:fixed; bottom:22px; left:50%; transform:translate(-50%,20px); background:var(--ink); color:white; border-radius:9px; padding:11px 16px; opacity:0; pointer-events:none; transition:.25s; z-index:50; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.account-actions { display:flex; align-items:center; gap:10px; }
.account-email { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:12px; }
.account-button { text-decoration:none; }
.sync-status { margin:13px 0 -3px; color:#7c8b85; font-size:11px; text-align:right; }
.reminder-panel { position:fixed; right:22px; bottom:22px; z-index:45; width:min(390px,calc(100vw - 28px)); max-height:min(560px,calc(100vh - 44px)); overflow:auto; padding:21px; border:1px solid rgba(43,88,73,.22); border-radius:16px; background:#fffef9; box-shadow:0 20px 60px rgba(19,50,41,.2); }
.reminder-panel[hidden] { display:none; }
.reminder-panel h2 { margin:5px 36px 15px 0; font:800 20px Manrope,sans-serif; }
.reminder-close { position:absolute; top:13px; right:13px; width:32px; height:32px; display:grid; place-items:center; border:0; border-radius:50%; background:transparent; color:#61726b; font-size:23px; cursor:pointer; }
.reminder-close:hover { background:#eef1e8; color:var(--ink); }
.reminder-list { display:grid; gap:8px; }
.reminder-item { width:100%; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px; border:1px solid #e2e5dc; border-radius:10px; background:#faf9f3; color:var(--ink); text-align:left; cursor:pointer; }
.reminder-item:hover { border-color:#91aa9e; background:#f4f6ed; }
.reminder-item span:first-child { min-width:0; display:grid; gap:3px; }
.reminder-item strong { overflow:hidden; text-overflow:ellipsis; font-size:13px; }
.reminder-item small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:11px; }
.reminder-age { flex:0 0 auto; min-width:38px; padding:5px 7px; border-radius:99px; background:#fff0bd; color:#8a651d; font-size:11px; font-weight:800; text-align:center; }
@media (max-width:850px) {
  .backup-action { display:none; }
  .hero-stamp { display:none; }
  .stats { grid-template-columns:1fr 1fr; }
  .stat:nth-child(2) { border-right:0; }
  .stat:nth-child(-n+2) { border-bottom:1px solid var(--line); }
  .toolbar { flex-wrap:wrap; }
  .toolbar .search-wrap { flex-basis:100%; }
  .toolbar select { flex:1; }
  table,tbody,tr,td { display:block; }
  thead { display:none; }
  tbody tr { padding:16px 17px; border-bottom:1px solid var(--line); display:grid; grid-template-columns:1fr 1fr; gap:13px; }
  td { border:0; padding:0; }
  td::before { content:attr(data-label); display:block; color:#89958f; font-size:9px; letter-spacing:.1em; text-transform:uppercase; margin-bottom:4px; }
  .row-actions { justify-content:flex-start; }
  .contact-composer { grid-template-columns:1fr 1fr; }
  .contact-summary { grid-column:1/-1; }
  .history-item { grid-template-columns:90px 110px 1fr auto; }
}
@media (max-width:600px) {
  .topbar { padding:0 15px; }
  .header-actions { gap:5px; }
  .header-actions .button { padding:9px 10px; font-size:12px; }
  .account-email { display:none; }
  .account-button { display:none; }
  main { padding-inline:12px; }
  main { padding-top:20px; }
  .semester-bar { padding:22px; align-items:start; gap:15px; }
  .semester-actions { flex-direction:column; align-items:stretch; gap:7px; }
  #semesterSelect { font-size:22px; max-width:200px; }
  .stat { padding:18px 20px; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .full { grid-column:auto; }
  .toolbar select { width:100%; flex-basis:100%; }
  tbody tr { grid-template-columns:1fr; }
  .contact-composer,.history-item { grid-template-columns:1fr; }
  .contact-summary,.composer-actions { grid-column:auto; }
  .history-remove { justify-self:start; }
  .reminder-panel { right:14px; bottom:14px; }
}
