:root {
  --bg: #f2f2f2;
  --card: #ffffff;
  --border: #d9d9d9;
  --text: #222;
  --muted: #666;
  --accent: #0a6cff;
}
* { box-sizing: border-box; }
body {
  font-family: Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }

header.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
header.topbar h1 { margin: 0; font-size: 18px; }
header.topbar .spacer { flex: 1; }
header.topbar .small { color: var(--muted); font-size: 12px; }
#userInfo {
  color: #000;
  font-size: 14px;
  font-weight: 700;
}

.container {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1600px;
  }
  .card {
    padding: 24px;
  }
  body {
    font-size: 16px;
  }
  .table th, .table td {
    font-size: 15px;
  }
  button {
    padding: 11px 16px;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1800px;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

@media (max-width: 900px) {
  .hide-on-mobile {
    display: none !important;
  }
}

label { font-size: 13px; color: var(--muted); }
input, select, button {
  font: inherit;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button:hover {
  filter: brightness(0.95);
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.status {
  font-size: 12px;
  color: #c62828;
  font-weight: 700;
  white-space: pre-wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  vertical-align: middle;
}

.col-chantier {
  white-space: normal;
  min-width: 260px;
}

.table-wrap {
  overflow-x: auto;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.folder-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
  max-height: 320px;
  overflow: auto;
}
.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.folder-item:hover {
  background: #f0f4ff;
}
.folder-item.active {
  background: #e8f0ff;
  font-weight: 700;
}

.explorer {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}
.explorer-sidebar {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 8px;
  max-width: 340px;
  max-height: 520px;
  overflow: auto;
}
.explorer-main {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #f7f7f7;
}
.explorer-path {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.explorer-table th, .explorer-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.explorer-table tr:hover {
  background: #f5f9ff;
}
.explorer-row {
  cursor: pointer;
}
.explorer-muted {
  color: var(--muted);
  font-size: 12px;
}

.preview-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.preview-title {
  font-size: 13px;
  color: var(--muted);
}
.preview-canvas {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 2px;
}
.thumb {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  background: #fff;
  cursor: pointer;
  min-width: 110px;
}
.thumb.active {
  outline: 2px solid #0a6cff;
}
.thumb canvas {
  display: block;
  width: 110px;
  height: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  width: 420px;
  max-width: 92vw;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 16px;
}
.modal h3 { margin: 0 0 8px 0; }
.modal .row { margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }

.message-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.message-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  height: 320px;
  overflow: auto;
}
.message-item {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
}
.message-item.unread {
  background: #f2f2f2;
  border-radius: 6px;
}
.message-badge {
  margin-left: auto;
  background: #0a6cff;
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}
.message-item:last-child {
  border-bottom: none;
}
.message-meta {
  font-size: 12px;
  color: var(--muted);
}
.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.message-actions button {
  padding: 4px 8px;
  font-size: 12px;
}
