:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1c1f26;
  --muted: #6b7280;
  --accent: #e41e2d; /* FRY red */
  --accent-dark: #b6141f;
  --accent-bg: #fdeceb;

  --status-signed: #1a8754;
  --status-signed-bg: #e8f7ef;
  --status-pending: #b8860b;
  --status-pending-bg: #fff6e0;
  --status-finished: #6b7280;
  --status-finished-bg: #eef0f2;

  --type-reel: #c13584;
  --type-tiktok: #0f9d9d;
  --type-story: #8a3ab9;
  --type-carousel: #e08a00;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--accent);
  color: white;
  flex-wrap: wrap;
  gap: 10px;
}

header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

header.topbar .brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.2px;
}

header.topbar .sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 2px;
}

nav.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 22px 0;
  max-width: 1320px;
  margin: 0 auto;
}

nav.tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

nav.tabs button:hover {
  color: var(--text);
}

nav.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  padding: 18px 22px 60px;
  max-width: 1320px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title h2 {
  font-size: 16px;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: var(--bg);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.btn.danger {
  background: #c0392b;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  min-width: 0;
}

.deliverable-lines {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.deliverable-lines .dl-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.dl-row {
  display: grid;
  grid-template-columns: 1fr 110px 34px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.dl-empty {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin-bottom: 8px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn:hover {
  background: #fdecea;
  border-color: #f3b7b0;
  color: #c0392b;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid #f0f1f4;
  vertical-align: top;
}

tbody tr:hover {
  background: #fafbfc;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.type-reel { background: var(--type-reel); }
.type-tiktok { background: var(--type-tiktok); }
.type-story { background: var(--type-story); }
.type-carousel { background: var(--type-carousel); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge.signed { color: var(--status-signed); background: var(--status-signed-bg); }
.badge.pending { color: var(--status-pending); background: var(--status-pending-bg); }
.badge.finished { color: var(--status-finished); background: var(--status-finished-bg); }

.deliv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.empty-state {
  color: var(--muted);
  padding: 30px 10px;
  text-align: center;
  font-size: 13px;
}

/* --- Tab 2: content planner --- */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .field {
  min-width: 220px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  border-top: 3px solid var(--border);
}

.summary-card .sc-type {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.summary-card .sc-numbers {
  display: flex;
  gap: 14px;
}

.summary-card .sc-num {
  text-align: center;
}

.summary-card .sc-num .n {
  font-size: 20px;
  font-weight: 700;
  display: block;
}

.summary-card .sc-num .l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-toggle {
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.status-toggle.planned {
  color: var(--status-pending);
  background: var(--status-pending-bg);
  border-color: transparent;
}

.status-toggle.delivered {
  color: var(--status-signed);
  background: var(--status-signed-bg);
  border-color: transparent;
}

/* --- Tab 3: calendar --- */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav .month-label {
  font-size: 16px;
  font-weight: 700;
  min-width: 150px;
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dow {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 6px;
}

.cal-day {
  min-height: 108px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-day.outside {
  background: #fafbfc;
  color: #c3c7ce;
}

.cal-day.today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-day .day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.cal-day.today .day-num {
  color: var(--accent);
}

.cal-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-event-wrap {
  display: flex;
  flex-direction: column;
}

.cal-event {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-event .ce-check {
  flex-shrink: 0;
}

.cal-event-detail {
  margin: 3px 0 2px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 6px;
  background: var(--bg);
  font-size: 11px;
  line-height: 1.5;
  white-space: normal;
}

.cal-event-detail .ced-type {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.cal-event-detail .ced-status {
  color: var(--muted);
}

.cal-event-detail .ced-notes {
  color: var(--text);
  font-style: italic;
  margin-top: 2px;
}

/* --- Tab 3: content breakdown pie --- */

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

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}

.legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

@media (max-width: 760px) {
  .cal-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .cal-day {
    min-height: 74px;
    padding: 4px;
  }
  .cal-event {
    font-size: 9px;
  }
}
