:root {
  --bg: #0f1115;
  --bg-2: #181b22;
  --bg-3: #232734;
  --text: #e8e9ed;
  --text-dim: #9ca0aa;
  --accent: #6c9bff;
  --accent-2: #4d7be6;
  --danger: #e85a5a;
  --danger-2: #c84545;
  --border: #2a2f3b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100%;
}
.screen {
  min-height: 100vh;
}
button {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}
button:hover {
  background: #2c3142;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.primary:hover {
  background: var(--accent-2);
}
button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
button.danger:hover {
  background: var(--danger-2);
}
input,
textarea,
select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
  font-family: inherit;
}
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input[type='file'] {
  padding: 0.3rem;
}
label {
  display: block;
  margin: 0.6rem 0 0.2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
label > input,
label > textarea {
  margin-top: 0.25rem;
}
.error {
  color: var(--danger);
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}
.success {
  color: #6cc78a;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

#login {
  display: flex;
  align-items: center;
  justify-content: center;
}
#login .card {
  background: var(--bg-2);
  padding: 2rem;
  border-radius: 12px;
  min-width: 320px;
  box-shadow: var(--shadow);
}
#login h1 {
  margin: 0 0 1rem;
  text-align: center;
}
#login button {
  width: 100%;
  margin-top: 1rem;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
#login button:hover {
  background: var(--accent-2);
}

#app header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.nav,
.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
#week-label {
  margin-left: 1rem;
  color: var(--text-dim);
  font-weight: 500;
}

#week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  padding: 1px;
}
.day-col {
  background: var(--bg);
  min-height: calc(100vh - 70px);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
}
.day-col.today {
  background: #131826;
}
.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.day-header .label {
  font-weight: 600;
}
.day-header .date {
  color: var(--text-dim);
  font-size: 0.8rem;
}
.day-header button {
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
}
.day-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.event-item {
  background: var(--bg-3);
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  border-left: 3px solid var(--accent);
  font-size: 0.85rem;
}
.event-item:hover {
  background: #2c3142;
}
.event-item .time {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.event-item .title {
  font-weight: 500;
  margin-top: 0.1rem;
}
.event-item .badge {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: 0.3rem;
}
.add-event {
  margin-top: 0.5rem;
  color: var(--text-dim);
  border-style: dashed;
  background: transparent;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-2);
  padding: 1.5rem;
  border-radius: 12px;
  min-width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  z-index: 11;
}
.modal h2 {
  margin: 0 0 0.5rem;
}
.modal h3 {
  margin: 1rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.modal .row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}
.modal .row > * {
  flex: 1;
}
.modal .row > button {
  flex: 0 0 auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
#event-files-list,
#day-files-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}
#event-files-list li,
#day-files-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.55rem;
  background: var(--bg-3);
  border-radius: 4px;
  margin-bottom: 0.3rem;
}
#event-files-list li a,
#day-files-list li a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  margin-right: 0.5rem;
}
#event-files-list li a:hover,
#day-files-list li a:hover {
  text-decoration: underline;
}
.file-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}
.file-actions .size {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.file-actions button {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}
.hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}
