:root {
  --navy: #0B1D33;
  --navy-2: #13294B;
  --blue: #2E86FF;
  --blue-dark: #1a6fe0;
  --green: #7ED321;
  --text: #1c2b3a;
  --muted: #6b7c8f;
  --border: #e3e8ee;
  --bg: #f5f7fa;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Manrope, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9em 1.5em;
}
.topbar .brand { font-weight: 700; font-size: 1.1em; }
.topbar .brand span { color: var(--green); font-weight: 400; }
.topbar nav { display: flex; align-items: center; gap: 1.2em; }
.topbar .who { color: rgba(255,255,255,.7); font-size: .9em; }
.topbar a { color: #fff; font-weight: 600; }
.topbar a:hover { color: var(--green); }

.container { max-width: 1100px; margin: 0 auto; padding: 2em 1.5em; }

.page-head { display: flex; align-items: center; gap: 1em; margin-bottom: 1.2em; }
.page-head h1 { margin: 0; font-size: 1.6em; color: var(--navy-2); }

.stat-row { display: flex; flex-wrap: wrap; gap: .6em; margin-bottom: 1.2em; }
.stat {
  display: flex; align-items: center; gap: .5em;
  padding: .5em 1em; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--muted); font-weight: 600; font-size: .9em;
}
.stat span {
  background: var(--bg); color: var(--text); border-radius: 999px;
  padding: .1em .6em; font-size: .85em;
}
.stat.active { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.stat.active span { background: rgba(255,255,255,.2); color: #fff; }

.search-row { display: flex; gap: .6em; margin-bottom: 1.5em; align-items: center; }
.search-row input[type="text"] {
  flex: 1; padding: .7em 1em; border-radius: 6px; border: 1px solid var(--border); font-size: 1em;
}
.search-row button {
  padding: .7em 1.4em; border-radius: 6px; border: none; background: var(--blue);
  color: #fff; font-weight: 600; cursor: pointer;
}
.search-row button:hover { background: var(--blue-dark); }
.search-row .clear { font-size: .9em; }

.table-wrap { background: #fff; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .9em 1.1em; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr { cursor: pointer; transition: background-color .15s ease; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: "SF Mono", Consolas, monospace; font-weight: 600; color: var(--navy-2); }
.empty { text-align: center; color: var(--muted); padding: 2.5em; cursor: default; }

.badge { display: inline-block; padding: .3em .8em; border-radius: 999px; font-size: .8em; font-weight: 700; }
.badge-new { background: #e6f0ff; color: var(--blue-dark); }
.badge-in_progress { background: #fff3d6; color: #a8710a; }
.badge-done { background: #e3f7e3; color: #237a23; }
.badge-cancelled { background: #f1f1f1; color: #777; }

.back-link { display: inline-block; margin-bottom: 1em; font-weight: 600; }

.delete-form { margin-left: auto; }
.delete-form button {
  padding: .4em 1em; border-radius: 6px; border: 1px solid #e0a0a0;
  background: #fdeaea; color: #a13b3b; font-weight: 600; cursor: pointer; font-size: .9em;
}
.delete-form button:hover { background: #fbdada; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 1.4em; grid-column: span 1;
}
.card:nth-child(2) { grid-column: span 2; }
.card h2 { margin: 0 0 .8em; font-size: 1.05em; color: var(--navy-2); }
dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .5em 1em; }
dt { color: var(--muted); font-size: .85em; }
dd { margin: 0; }
.description { white-space: pre-wrap; line-height: 1.5; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8em; }
.photo-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.status-form { display: flex; gap: .6em; }
.status-form select {
  flex: 1; padding: .6em .8em; border-radius: 6px; border: 1px solid var(--border); font-size: 1em;
}
.status-form button, .note-form button {
  padding: .6em 1.4em; border-radius: 6px; border: none; background: var(--blue);
  color: #fff; font-weight: 600; cursor: pointer;
}
.status-form button:hover, .note-form button:hover { background: var(--blue-dark); }

.note-form { display: flex; flex-direction: column; gap: .6em; margin-bottom: 1em; }
.note-form textarea {
  min-height: 70px; padding: .7em; border-radius: 6px; border: 1px solid var(--border);
  font-family: inherit; font-size: .95em; resize: vertical;
}
.note-form button { align-self: flex-start; }
.note { padding: .8em 0; border-top: 1px solid var(--border); }
.note-meta { font-size: .8em; color: var(--muted); margin-bottom: .2em; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 90vh; }
.login-card {
  background: #fff; border-radius: 12px; border: 1px solid var(--border);
  padding: 2.5em; width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(11,29,51,.08);
}
.login-brand { font-weight: 700; font-size: 1.3em; color: var(--navy-2); margin-bottom: 1.2em; text-align: center; }
.login-brand span { color: var(--green); font-weight: 400; display: block; font-size: .6em; }
.login-card form { display: flex; flex-direction: column; gap: 1em; }
.login-card label { display: flex; flex-direction: column; gap: .4em; font-weight: 600; font-size: .9em; color: var(--muted); }
.login-card input {
  padding: .8em .9em; border-radius: 6px; border: 1px solid var(--border); font-size: 1em;
}
.login-card button {
  padding: .8em; border-radius: 6px; border: none; background: var(--blue);
  color: #fff; font-weight: 700; cursor: pointer; font-size: 1em; margin-top: .5em;
}
.login-card button:hover { background: var(--blue-dark); }
.alert { background: #fdeaea; color: #a13b3b; padding: .8em 1em; border-radius: 6px; margin-bottom: 1em; font-size: .9em; }
.alert-ok { background: #e3f7e3; color: #237a23; }
.forgot-link { display: block; text-align: center; margin-top: 1.2em; font-size: .9em; font-weight: 600; }
.hint { color: var(--muted); font-size: .9em; margin: -0.4em 0 1.2em; }

.account-card { max-width: 480px; }
.account-form { display: flex; flex-direction: column; gap: 1em; }
.account-form label { display: flex; flex-direction: column; gap: .4em; font-weight: 600; font-size: .9em; color: var(--muted); }
.account-form input {
  padding: .7em .9em; border-radius: 6px; border: 1px solid var(--border); font-size: 1em; font-weight: 400; color: var(--text);
}
.account-form hr { border: none; border-top: 1px solid var(--border); margin: .2em 0; width: 100%; }
.account-form .muted-hint { font-weight: 400; color: var(--muted); font-size: .85em; }
.account-form button {
  align-self: flex-start; padding: .8em 1.6em; border-radius: 6px; border: none; background: var(--blue);
  color: #fff; font-weight: 700; cursor: pointer; font-size: 1em;
}
.account-form button:hover { background: var(--blue-dark); }

@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
  .card:nth-child(2) { grid-column: span 1; }
  .container { padding: 1.2em 1em; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr { border-bottom: 1px solid var(--border); padding: .8em 1em; }
  tbody td { border: none; padding: .2em 0; }
  tbody td:first-child { font-size: 1.05em; }
}
