:root {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --top: #2c2c2c;
  --side: #1f1f1f;
  --accent: #714B67;
  --accent-2: #00A09D;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --border: #e4e4e4;
  --ok: #28a745;
  --ok-bg: #e8f8ef;
  --done: #0d7377;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}
a { color: inherit; text-decoration: none; }
.topbar {
  min-height: 46px;
  height: 46px;
  background: var(--top);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  overflow: visible;
  position: relative;
  z-index: 100;
}
.topbar .nav {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: nowrap;
  overflow: visible;
  flex: 1;
  min-width: 0;
}
.topbar .nav > a { opacity: .85; font-size: 14px; white-space: nowrap; }
.topbar .nav > a.active,
.topbar .nav > a:hover { opacity: 1; border-bottom: 2px solid #fff; }
.topbar .nav > a.apps-btn {
  opacity: 1;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  border-bottom: none !important;
}
.topbar .nav > a.app-name {
  font-weight: 700;
  font-size: 15px;
  opacity: 1;
  margin-left: 4px;
  border-bottom: none !important;
}
.nav-drop {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.nav-drop > .nav-drop-btn {
  opacity: .85;
  font-size: 14px;
  color: #fff !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  font-family: inherit;
  padding: 0 0 2px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: inherit;
}
.nav-drop > .nav-drop-btn:hover,
.nav-drop.open > .nav-drop-btn,
.nav-drop > .nav-drop-btn.active {
  opacity: 1;
  border-bottom: 2px solid #fff !important;
}
.nav-drop-menu {
  display: none !important;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 150px;
  background: #fff;
  color: #222;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  padding: 4px 0;
  z-index: 5000;
  direction: rtl;
}
.nav-drop.open > .nav-drop-menu,
.nav-drop:hover > .nav-drop-menu {
  display: block !important;
}
.nav-drop-menu a {
  display: block !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  color: #333 !important;
  text-decoration: none !important;
  opacity: 1 !important;
  border: none !important;
  border-bottom: none !important;
  background: transparent !important;
  white-space: nowrap;
}
.nav-drop-menu a:hover,
.nav-drop-menu a.active {
  background: #f3eaf1 !important;
  color: #714B67 !important;
}
.layout { display: grid; grid-template-columns: 52px 1fr; min-height: calc(100vh - 46px); }
.sidebar {
  background: var(--side);
  color: #fff;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.sidebar a {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  opacity: .85;
  font-size: 0;
}
.sidebar a:hover, .sidebar a.active { background: #333; opacity: 1; }
.sidebar .ico { font-size: 18px; display: block; line-height: 1; margin: 0; }
.sidebar .ico img {
  width: 32px; height: 32px; border-radius: 8px;
  object-fit: cover; display: block; margin: 0 auto;
}
.content { padding: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  background: #714B67;
  color: #fff;
  font-size: 14px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: #333; border: 1px solid #ccc; }
.btn.green { background: #28a745; }
.btn.teal { background: #00A09D; }
.grid-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.app-tile {
  background: #fff;
  border-radius: 12px;
  padding: 18px 10px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform .15s ease;
}
.app-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.app-tile .icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; margin: 0 auto 10px; font-size: 26px; color: #fff;
}
.app-tile .icon.icon-img {
  background: transparent; padding: 0; overflow: hidden;
}
.app-tile .icon img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 14px;
}
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
}
.search {
  flex: 1; min-width: 180px;
  border: 1px solid #ccc; border-radius: 6px; padding: 8px 12px; font-size: 14px;
}
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: right; font-size: 13px; }
th { background: #fafafa; color: var(--muted); font-weight: 600; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.done { background: #d7f0f1; color: var(--done); }
.badge.open { background: #e8f8ef; color: #1e7e34; }
.muted { color: var(--muted); }
.pos-card {
  max-width: 420px;
  position: relative;
}
.pos-card h3 { margin: 0 0 8px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
}
.user-chip .logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
  margin-right: 4px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 6px;
  line-height: 0;
}
.user-chip .logout-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.9);
}
.user-chip .logout-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #7c4dff; color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; overflow-x: auto; justify-content: flex-start;
    padding: 8px;
  }
  .sidebar a { min-width: 72px; }
}