:root {
  --ink: #1c1915;
  --muted: #6d645b;
  --line: #ddd4c8;
  --paper: #f3eee6;
  --card: #fffdf8;
  --green: #1f2a24;
  --copper: #c45c26;
  --copper-dark: #9a4318;
  --danger: #8d2b2b;
  --ok: #246246;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(31, 42, 36, 0.04), transparent 220px),
    var(--paper);
  font-family: "Segoe UI", "Sukhumvit Set", "Noto Sans Thai", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { cursor: wait; opacity: 0.65; }

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.top {
  background: var(--green);
  color: #f3ecdf;
}

.top-inner, main {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.top-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 0;
}

.brand { display: flex; gap: 12px; align-items: center; }

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f3ecdf;
  color: var(--green);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.product { margin: 0; font-size: 20px; font-weight: 700; }

.tag { margin: 2px 0 0; color: #c9c0b4; font-size: 14px; }

.top a {
  color: #f3ecdf;
  font-size: 14px;
  font-weight: 650;
}

main { padding: 28px 0 64px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.session-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

h2, h3 { margin: 0 0 8px; }

h2 { font-size: 18px; }
h3 { font-size: 16px; }

.hint, .muted { color: var(--muted); }

.hint { margin: 0 0 14px; font-size: 14px; }

form { display: grid; gap: 12px; align-content: start; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cfc4b6;
  border-radius: 8px;
  background: #fff;
  font-weight: 400;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.check { display: flex; gap: 6px; align-items: center; font-weight: 500; }

button.primary, button.ghost, button.danger, a.button-link {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

button.primary { background: var(--copper); color: white; }
button.primary:hover { background: var(--copper-dark); }

button.ghost, a.button-link {
  background: transparent;
  border-color: var(--line);
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.ghost:hover, a.button-link:hover { background: #f7f2ea; }

button.danger { background: transparent; color: var(--danger); border-color: #efd0d0; }
button.danger:hover { background: #fff5f5; }

.message, #session-message, #app-message, #upload-status, #list-note, #dns-result {
  min-height: 1.2em;
  margin: 14px 0 0;
  font-size: 14px;
}

.message[data-kind="error"],
#session-message[data-kind="error"],
#app-message[data-kind="error"],
#upload-status[data-kind="error"],
#dns-result[data-kind="error"] { color: var(--danger); }

.message[data-kind="ok"],
#session-message[data-kind="ok"],
#app-message[data-kind="ok"],
#upload-status[data-kind="ok"],
#dns-result[data-kind="ok"] { color: var(--ok); }

.drive-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.drive-head h2, .drive-head p { margin: 0; }
.drive-head p { color: var(--muted); font-size: 14px; }

.meter {
  height: 8px;
  margin-top: 14px;
  border-radius: 99px;
  background: #efe7dc;
  overflow: hidden;
}

#quota-bar, .quota-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
}

#quota-bar.full, .quota-bar.full { background: var(--danger); }

.site-list { display: grid; gap: 10px; margin-top: 16px; }

.site-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.site-card p { margin: 0; color: var(--muted); font-size: 14px; }

.dns, .note {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f2ea;
}

.dns p, .note p { margin: 0 0 8px; }

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  word-break: break-all;
}

.dropzone {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-top: 16px;
  padding: 28px 16px;
  border: 1.5px dashed #c8bfb2;
  border-radius: 12px;
  background: #fcfaf6;
  text-align: center;
  cursor: pointer;
}

.dropzone strong { font-size: 16px; }
.dropzone span { color: var(--muted); font-size: 14px; font-weight: 400; }
.dropzone.over { border-color: var(--copper); background: #fff6ee; }

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.table-wrap { margin-top: 8px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.02em; }

.name {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

td.actions { white-space: nowrap; text-align: right; }

td.actions button, td.actions input, td.actions select { min-height: 34px; }
td.actions select { width: 150px; font-weight: 400; }

td.actions button { padding: 6px 10px; }

td.actions input[type="number"] { width: 96px; min-height: 34px; }

#empty-state, #sites-empty {
  margin: 18px 0 4px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .session-grid, .drive-head, .site-card { grid-template-columns: 1fr; display: grid; }
  .top-inner, main { width: min(980px, calc(100% - 20px)); }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; width: auto; }
  thead { display: none; }
  tr {
    margin-top: 10px;
    padding: 10px 10px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  td { border: 0; padding: 2px 0; text-align: left; }
  .name { max-width: none; white-space: normal; }
  td.num { text-align: left; }
  td.actions { padding-top: 8px; }
  td.actions input[type="number"], td.actions select { width: 100%; }
}
