:root {
  color-scheme: dark;
  --bg: #151515;
  --panel: #242424;
  --panel-2: #333333;
  --line: #444444;
  --text: #eeeeee;
  --muted: #a9a9a9;
  --accent: #10a6d8;
  --green: #65bd48;
  --orange: #f6a623;
  --red: #d9534f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.danger {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.ghost {
  background: transparent;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 52px;
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 0 12px;
  background: linear-gradient(#202020, #111111);
  border-bottom: 1px solid #000;
}

.logo {
  font-weight: 700;
}

.logo span,
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange);
  color: #231b08;
  font-weight: 900;
}

.active-bar {
  color: var(--accent);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 52px);
}

.sidebar {
  background: #181818;
  border-right: 1px solid #050505;
  overflow: auto;
}

.sidebar-actions {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tree {
  padding: 8px;
}

.tree-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 3px 6px;
  border-radius: 4px;
}

.tree-row.work {
  cursor: pointer;
}

.tree-row.selected {
  background: var(--accent);
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-client {
  color: var(--green);
  font-weight: 700;
}

.tree-project {
  padding-left: 18px;
  color: #d8d8d8;
}

.tree-work {
  padding-left: 36px;
}

.mini {
  width: 28px;
  min-height: 26px;
  padding: 0;
}

.workspace {
  overflow: auto;
  background: #3a3a3a;
}

.empty-state {
  padding: 56px;
  color: var(--muted);
}

.detail {
  padding: 24px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.breadcrumb {
  color: var(--muted);
  margin: 0 0 4px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.summary-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.summary-grid strong {
  font-size: 24px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab {
  border-radius: 0;
  border-bottom: 0;
}

.tab.active {
  background: #111;
  color: white;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f7f7;
  color: #151515;
  padding: 8px;
}

.timer-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.timer-display {
  min-width: 180px;
  border: 2px solid #9c5b00;
  background: var(--orange);
  color: #111;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 6px 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #1e1e1e;
  color: var(--muted);
}

tr:nth-child(even) td {
  background: #2d2d2d;
}

tfoot td {
  background: #151515;
  color: var(--text);
  font-weight: 700;
}

tfoot td:first-child {
  text-align: right;
}

.entries-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  padding: 0 0 8px;
  color: var(--muted);
}

.running-entry td {
  background: #143747 !important;
}

.timer-notice {
  margin-bottom: 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #18313a;
  color: #d9f5ff;
  padding: 10px 12px;
}

dialog {
  width: min(620px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 65%);
}

dialog form {
  display: grid;
  gap: 14px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.login-body {
  display: grid;
  place-items: center;
  background: #101010;
}

.login-panel {
  width: min(380px, calc(100vw - 32px));
  display: grid;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.login-panel form {
  display: grid;
  gap: 14px;
}

.error {
  min-height: 20px;
  color: #ff8c88;
  margin: 0;
}

.admin-layout {
  display: grid;
  gap: 16px;
}

.admin-layout header,
.user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.admin-columns {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
}

.audit-list,
#usersList {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.audit-item,
.user-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #1f1f1f;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  color: var(--text);
}

.inline-check input {
  width: auto;
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .active-bar {
    display: none;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    max-height: 42vh;
  }

  .summary-grid,
  .admin-columns,
  .user-form {
    grid-template-columns: 1fr;
  }
}
