:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #162b29;
  background: #f2f6f5;
  --surface: #fff;
  --ink: #162b29;
  --muted: #526762;
  --line: #dce7e3;
  --accent: #08715e;
  --accent-dark: #065645;
  --soft: #e8f2ed;
  --shadow: 0 10px 30px #153b3010;
  --radius: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
a { color: #096651; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #0b8f74;
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.app-header { background: #0d2725; color: #e9f7f1; border-bottom: 1px solid #234841; }
.app-header-inner {
  max-width: 1510px;
  margin: auto;
  min-height: 64px;
  padding: 9px clamp(16px, 3vw, 38px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.app-header a { color: inherit; text-decoration: none; }
.workspace-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.22rem; font-weight: 780; letter-spacing: -.035em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #0c342b; background: #8eebba; }
.workspace-switch { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; }
.workspace-switch label { margin: 0; color: #aed2c7; font-size: .78rem; }
.workspace-switch select {
  width: auto;
  max-width: min(310px, 65vw);
  padding: 7px 10px;
  border-color: #3e6059;
  background: #173c37;
  color: #f2faf6;
}
.header-profile { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.header-profile form { margin: 0; }
.header-username { color: #c8e0d8; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; max-width: 115px; white-space: nowrap; }
.app-header .logout { padding: 7px 10px; border: 1px solid #3e6059; background: transparent; color: #e9f7f1; font-size: .83rem; }
.app-header .logout:hover { background: #234842; }

.app-main { max-width: 1250px; margin: 26px auto; padding: 0 clamp(14px, 3vw, 32px) 28px; min-width: 0; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.025em; }
h1 { margin: 10px 0 15px; font-size: clamp(1.65rem, 3.2vw, 2.35rem); line-height: 1.14; }
h2 { margin: 23px 0 11px; font-size: clamp(1.15rem, 2vw, 1.45rem); }
h3 { margin: 14px 0 8px; font-size: 1.05rem; }
p { line-height: 1.5; }
.muted, small { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 2.1vw, 22px); box-shadow: var(--shadow); }
.value { margin-top: 7px; font-size: clamp(1.35rem, 2.7vw, 1.9rem); font-weight: 760; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }

.btn, button {
  display: inline-block;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, button:hover { background: var(--accent-dark); }
.secondary { border-color: #d6e7df; background: #edf5f1; color: #194439; }
.secondary:hover { background: #dceee5; }
button:disabled { cursor: default; opacity: .6; }
summary { cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e6eeeb; text-align: left; vertical-align: top; }
thead th { background: #f4f8f6; color: #425f57; font-size: .84rem; font-weight: 690; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tfoot th, tfoot td { border-top: 1px solid #dbe8e1; font-weight: 730; }
.table-wrap { overflow-x: auto; }

input, select, textarea { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #cbdcd5; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input:disabled, select:disabled { background: #edf3f0; color: #4c645c; }
form p { max-width: 480px; }
label { display: block; margin-bottom: 5px; font-weight: 640; }
ul.errorlist { color: #9b2e2a; }
.tag-badge { display: inline-block; margin: 3px 0; padding: 2px 7px; border-radius: 12px; background: #e5f0e9; color: #265b49; font-size: .82em; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0; }
.tag-picker label { display: inline-flex; align-items: center; margin: 0; background: #e5f0e9; border-radius: 8px; padding: 4px 7px; }
.tag-picker input { width: auto; margin-right: 6px; }

.app-messages { margin-bottom: 12px; }
.app-message { margin: 0 0 6px; padding: 10px 13px; border-radius: 10px; background: #e1f4ea; color: #185946; border: 1px solid #c7e9d8; }
.app-message.error { background: #fff1ef; color: #8b2e28; border-color: #f1d4cf; }

@media (max-width: 650px) {
  .app-header-inner { gap: 8px 12px; }
  .workspace-switch { order: 3; margin: 0; width: 100%; }
  .workspace-switch select { max-width: 100%; flex: 1; }
  .header-add { margin-left: auto; }
  .header-profile { margin-left: 0; }
  .header-username { display: none; }
  .app-main { margin-top: 16px; }
}

.login-layout { display: grid; grid-template-columns: 1.13fr 1fr; max-width: 920px; margin: clamp(20px, 8vh, 88px) auto; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 58px #153b3024; }
.login-intro { background: radial-gradient(ellipse at 100% 0%, #276752, transparent 70%), #12342d; color: #d6f2e5; padding: clamp(22px, 6vw, 55px); }
.login-kicker { color: #a8eccd; font-size: .82rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; margin: 0 0 10px; }
.login-intro h1 { max-width: 330px; color: #f5fff9; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.04em; }
.login-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 27px; }
.login-features span { display: inline-block; padding: 5px 8px; border: 1px solid #95d3bd65; border-radius: 8px; font-size: .8rem; }
.login-card { padding: clamp(22px, 5vw, 42px); border-radius: 0; box-shadow: none; }
.login-card h2 { margin-top: 0; font-size: 1.45rem; }
.login-card form p { margin: 0 0 14px; }
.login-card button { width: 100%; margin-top: 5px; }
@media (max-width: 650px) {
  .login-layout { grid-template-columns: minmax(0, 1fr); }
  .login-features { margin-top: 16px; }
}
