* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

:root {
  --bg: #1c1b19;
  --bg-panel: #23211e;
  --border: #7a7468;
  --border-focus: #a39f93;
  --text: #d4cfc7;
  --text-dim: #8a8579;
  --accent: #c9a84c;
  --accent-hover: #d4b85c;
  --success: #6b8e5c;
  --danger: #b85c4a;
  --input-bg: #1a1917;
  --shadow: rgba(0, 0, 0, 0.4);
  --radius: 0;
}

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(201, 168, 76, 0.02) 1px, transparent 1px),
    radial-gradient(circle at 80% 80%, rgba(122, 116, 104, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

#login-view:not([hidden]) { display: flex; }
#login-view[hidden] { display: none; }
#dashboard-view:not([hidden]) { display: block; }
#dashboard-view[hidden] { display: none; }
#loading-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 9999; }
#loading-screen.hidden { display: none; }
.loading-text { font-size: 8px; color: var(--text-dim); letter-spacing: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.panel {
  background: var(--bg-panel);
  border: 4px solid var(--border);
  box-shadow: 0 8px 24px var(--shadow);
  padding: 24px;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 4px;
  background: var(--border);
}

header { text-align: center; margin-bottom: 24px; position: relative; }

h1 {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--bg);
}

h2 { font-size: 10px; letter-spacing: 2px; color: var(--text); }

.subtitle { font-size: 6px; color: var(--text-dim); margin-top: 4px; letter-spacing: 2px; }

#login-view { display: none; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
#login-view:not([hidden]) { display: flex; }

.login-panel { width: 100%; max-width: 420px; transition: opacity 0.2s ease-out; }

.form-group { margin-bottom: 16px; }

label { display: block; font-size: 7px; color: var(--text-dim); margin-bottom: 8px; letter-spacing: 1px; }

input[type="password"],
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 3px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 8px;
  padding: 12px;
  outline: none;
  transition: border-color 0.1s;
}

input:focus, textarea:focus { border-color: var(--border-focus); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }

textarea { resize: vertical; min-height: 200px; line-height: 1.6; }

.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-group label { margin-bottom: 0; font-size: 6px; }

button {
  background: var(--bg-panel);
  border: 3px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.1s;
}

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

/* Utility */
.full-width { width: 100% !important; }
button:active { transform: translateY(1px); }

.btn-primary { width: 100%; font-size: 9px; padding: 14px; }
.btn-small { padding: 8px 12px; font-size: 7px; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--bg-panel); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }

.error {
  background: var(--input-bg);
  border: 3px solid var(--danger);
  color: var(--danger);
  font-size: 7px;
  padding: 12px;
  margin-bottom: 16px;
  display: none;
}
.error.show { display: block; }

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--border);
}

.header-left h1 { font-size: 12px; }
.header-right { display: flex; gap: 8px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr 350px;
  gap: 20px;
  align-items: start;
}

.panel-col { display: flex; flex-direction: column; min-height: 500px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--border);
}

.badge {
  background: var(--input-bg);
  border: 2px solid var(--border);
  color: var(--text-dim);
  font-size: 6px;
  padding: 4px 8px;
}

.input-group { display: flex; gap: 8px; margin-bottom: 12px; }
.input-group input { flex: 1; }

.filter-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.filter-tab {
  background: var(--input-bg);
  border: 2px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.1s;
}
.filter-tab.active, .filter-tab:hover { background: var(--border); color: var(--bg); }

.todo-list { list-style: none; flex: 1; overflow-y: auto; max-height: 350px; }
.todo-list::-webkit-scrollbar { width: 8px; }
.todo-list::-webkit-scrollbar-track { background: var(--input-bg); }
.todo-list::-webkit-scrollbar-thumb { background: var(--border); }

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--input-bg);
  border: 2px solid transparent;
  border-left: 4px solid var(--text);
  margin-bottom: 6px;
  animation: slide-in 0.2s ease-out;
  transition: all 0.1s;
}

.todo-item:hover { border-color: var(--border); transform: translateX(2px); }
.todo-item.completed .todo-text { text-decoration: line-through; color: var(--text-dim); }
.todo-item.completed { border-left-color: var(--success); opacity: 0.7; }

@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(10px); } }
.todo-item.removing { animation: slide-out 0.15s ease-in forwards; }

.checkbox {
  width: 18px;
  height: 18px;
  border: 3px solid var(--border);
  background: var(--bg-panel);
  cursor: pointer;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  transition: all 0.1s;
}

.checkbox:checked { background: var(--success); border-color: var(--success); }
.checkbox:checked::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-panel);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-text { flex: 1; font-size: 8px; line-height: 1.4; word-break: break-word; }

.delete-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--danger);
  color: var(--danger);
  background: var(--input-bg);
}

.delete-btn:hover { background: var(--danger); color: var(--bg-panel); }

.empty-state { text-align: center; padding: 30px 16px; color: var(--text-dim); }
.empty-state .icon { font-size: 24px; margin-bottom: 8px; opacity: 0.3; }
.empty-state p { font-size: 6px; line-height: 1.6; }

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed var(--text-dim);
  font-size: 6px;
  color: var(--text-dim);
}
.stats span { color: var(--text); }

#notes-textarea { flex: 1; min-height: 300px; }
.notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 6px;
  color: var(--text-dim);
}

.dropzone {
  background: var(--input-bg);
  border: 3px dashed var(--border);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
  margin-bottom: 12px;
}

.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(201, 168, 76, 0.05); }
.dropzone-icon { font-size: 24px; margin-bottom: 8px; }
.dropzone p { font-size: 7px; color: var(--text); margin-bottom: 4px; }
.dropzone-hint { font-size: 6px; color: var(--text-dim); }

.upload-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.progress-bar { flex: 1; height: 12px; background: var(--input-bg); border: 2px solid var(--border); }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }
.upload-progress span { font-size: 6px; color: var(--text-dim); }

.files-list { list-style: none; flex: 1; overflow-y: auto; max-height: 300px; }
.files-list::-webkit-scrollbar { width: 8px; }
.files-list::-webkit-scrollbar-track { background: var(--input-bg); }
.files-list::-webkit-scrollbar-thumb { background: var(--border); }

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--input-bg);
  border: 2px solid transparent;
  margin-bottom: 4px;
  animation: slide-in 0.2s ease-out;
}

.file-item:hover { border-color: var(--border); }
.file-icon { font-size: 14px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 7px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 5px; color: var(--text-dim); margin-top: 2px; }
.file-actions { display: flex; gap: 4px; }
.file-actions button { padding: 4px 8px; font-size: 6px; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); }
.modal-panel { position: relative; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px dashed var(--border); }
.modal-header h2 { font-size: 10px; }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-size: 7px; }
.setting-group input[type="number"] { width: 100px; }
.setting-hint { font-size: 6px; color: var(--text-dim); line-height: 1.4; }
.setting-divider { height: 1px; background: var(--border); }

.credential-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--input-bg);
  border: 2px solid var(--border);
}
.credential-item .credential-label { font-size: 6px; color: var(--text); }
.credential-item .credential-date { font-size: 5px; color: var(--text-dim); }

#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-panel);
  border: 3px solid var(--success);
  color: var(--success);
  font-size: 7px;
  padding: 10px 20px;
  animation: toast-in 0.2s ease-out;
  box-shadow: 0 4px 12px var(--shadow);
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.removing { animation: toast-out 0.2s ease-in forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  #notes-panel { grid-column: 1 / -1; order: -1; }
}

@media (max-width: 700px) {
  body { padding: 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  #notes-panel { order: 0; }
  .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .header-right { align-self: flex-end; }
  h1 { font-size: 11px; }
  .panel { padding: 16px; }
  .input-group { flex-direction: column; }
  .stats { flex-wrap: wrap; gap: 8px; }
  .filter-tabs { flex-wrap: wrap; }
}

/* T09 login shell extras */
.login-hint {
  font-size: 6px;
  color: var(--text-dim);
  text-align: center;
  margin: 16px 0;
  line-height: 1.8;
}
