:root {
  --bg: #f3f0e8;
  --bg-2: #e8e3d6;
  --ink: #1c2430;
  --muted: #5c6672;
  --line: #cfc7b6;
  --panel: #fffdf8;
  --brand: #0f4c5c;
  --brand-2: #16697a;
  --ok: #2f6f4e;
  --warn: #9a6700;
  --bad: #8b2e2e;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --radius: 14px;
  --font: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  min-height: 100vh;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0f4c5c, #123844);
  color: #f4f7f8;
  padding: 1.25rem 1rem;
}
.sidebar .brand {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 1.25rem;
  text-decoration: none;
}
.sidebar nav a {
  display: block;
  color: #d7e6ea;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  margin-bottom: 0.2rem;
  text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.main { padding: 1.25rem 1.5rem 2.5rem; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
h1,h2,h3 { font-family: var(--font); margin: 0 0 0.4rem; }
.muted { color: var(--muted); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat strong { display: block; font-size: 1.5rem; font-family: var(--font); }
.btn, button.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff !important;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none !important;
}
.btn.secondary { background: transparent; color: var(--brand) !important; border: 1px solid var(--line); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.94rem; }
th { color: var(--muted); font-size: 0.82rem; }
label { display: block; font-weight: 600; margin: 0.7rem 0 0.25rem; }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 0.9rem; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.7rem; align-items: end; }
.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--bg-2);
}
.badge.agreed, .badge.completed, .badge.active { background: #d9efe3; color: var(--ok); }
.badge.sent, .badge.processing { background: #fff1cc; color: var(--warn); }
.badge.rejected, .badge.blocked { background: #f3d6d6; color: var(--bad); }
.badge.draft, .badge.negotiating { background: #dce9ee; color: var(--brand); }
.folders { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem; }
.folder {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.folder:hover { border-color: var(--brand-2); text-decoration: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.9rem 0; }
.tabs a {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.messages { list-style: none; padding: 0; }
.messages li { padding: 0.7rem 0.9rem; border-radius: 10px; margin-bottom: 0.7rem; background: #e7f5ef; border: 1px solid #b7dcc8; }
.messages li.error { background: #f8e4e4; border-color: #e0b1b1; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.8rem;
}
.login-card h1 { font-size: 2rem; color: var(--brand); }
.help { font-size: 0.88rem; color: var(--muted); }
.history-item { border-left: 3px solid var(--brand-2); padding-left: 0.7rem; margin-bottom: 0.7rem; }
.checkbox-list { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 0.5rem; }
.checkbox-list label { font-weight: 500; display: flex; gap: 0.5rem; align-items: flex-start; }
.checkbox-list input { width: auto; margin-top: 0.2rem; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
